From patchwork Wed Nov 23 11:26:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksij Rempel X-Patchwork-Id: 24921 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2732135wrr; Wed, 23 Nov 2022 03:33:54 -0800 (PST) X-Google-Smtp-Source: AA0mqf7agnKPfdeAH5LNS8Z2K+2NOJREfkG71Flvr5jWAY0DcgUZMWByxee6xTBpNXjxRjwhYZWI X-Received: by 2002:a17:906:ca0e:b0:78c:1f2f:233e with SMTP id jt14-20020a170906ca0e00b0078c1f2f233emr8887095ejb.307.1669203234469; Wed, 23 Nov 2022 03:33:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669203234; cv=none; d=google.com; s=arc-20160816; b=Kt2zGbSq2JiO2t+F2A21XFEiNsOpGXcrR2h1NAxamCX+asRFNwf45BScv0HCeGftdq z/4EKLdOk/RIxbMl7mRS4Yr6XB3sRl5jVO/mueFzO2b5oxQt5PSjbm1OTbuXgw0TB0CE GX6XZiwevPgOpjy0VyC/mRB7zgtbFV5VWps22d98M+ED4iF3BTdJdJFUm6B+2XbAtpTb g2T8Rv2tWxJy0NAZxuWaquTh1otCOkmzWM4BF298EoHc8hfJpGqrCjSpweHUoi/1AbOn GGhhSmqAN94TciVD+8G5mcUFQ7ObPZcW77X8lxVUytM+8H+D6Vn0xzOyr2727YFI/BhK a81w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=TzOWLiwA1WAC6KjhmT1WvDB20s4lWP/084ASaZUJzt0=; b=nlEAdtfAf/Ta1/b5hetupgDFliM9zMQrQqOnPOhdNt9M6xQTg2cuIymjaGcQg98V8o Mg9L2xE1JCDxFITT06ITsOH6TE8r8vUeHfrNtYrAuJffq7PKQDWwRIH7IAxN4953W7l7 piq/+pDDVeyNXqSLggmX/sPyytDVw6q1AItBr7Os1Nz5xQDnqDT14L+RgFrvnpiZEegp ld8y60RQFZC3usEANLAwi2Oz8/psd8ekUbF1/Un/AuLesR+UQX0Rg8HJuZ7N//dM/dh2 qi5ofSNEPvLcri6rbL1YlxfbJLcmGVYX0kCCiCKYjI1X5i13S7fnFgoF8858qV/aT3x6 I4Hg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f17-20020a170906825100b00781d82a6fc9si10976948ejx.264.2022.11.23.03.33.31; Wed, 23 Nov 2022 03:33:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236527AbiKWL1E (ORCPT + 99 others); Wed, 23 Nov 2022 06:27:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235935AbiKWL0k (ORCPT ); Wed, 23 Nov 2022 06:26:40 -0500 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E7E5E9333 for ; Wed, 23 Nov 2022 03:26:39 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oxntd-0003vn-HZ; Wed, 23 Nov 2022 12:26:29 +0100 Received: from [2a0a:edc0:0:1101:1d::ac] (helo=dude04.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1oxntb-0062RG-FT; Wed, 23 Nov 2022 12:26:28 +0100 Received: from ore by dude04.red.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1oxntb-008jqk-3c; Wed, 23 Nov 2022 12:26:27 +0100 From: Oleksij Rempel To: Woojung Huh , UNGLinuxDriver@microchip.com, Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Oleksij Rempel , kernel@pengutronix.de, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Arun.Ramadoss@microchip.com Subject: [PATCH net-next v5 2/5] net: dsa: microchip: do not store max MTU for all ports Date: Wed, 23 Nov 2022 12:26:22 +0100 Message-Id: <20221123112625.2082797-3-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221123112625.2082797-1-o.rempel@pengutronix.de> References: <20221123112625.2082797-1-o.rempel@pengutronix.de> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750286450669743352?= X-GMAIL-MSGID: =?utf-8?q?1750286450669743352?= If we have global MTU configuration, it is enough to configure it on CPU port only. Signed-off-by: Oleksij Rempel Reviewed-by: Vladimir Oltean Reviewed-by: Florian Fainelli --- drivers/net/dsa/microchip/ksz9477.c | 14 +++++--------- drivers/net/dsa/microchip/ksz_common.h | 1 - 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c index 602d00671bef..f6e7968ab105 100644 --- a/drivers/net/dsa/microchip/ksz9477.c +++ b/drivers/net/dsa/microchip/ksz9477.c @@ -45,19 +45,15 @@ static void ksz9477_port_cfg32(struct ksz_device *dev, int port, int offset, int ksz9477_change_mtu(struct ksz_device *dev, int port, int mtu) { - u16 frame_size, max_frame = 0; - int i; - - frame_size = mtu + VLAN_ETH_HLEN + ETH_FCS_LEN; + u16 frame_size; - /* Cache the per-port MTU setting */ - dev->ports[port].max_frame = frame_size; + if (!dsa_is_cpu_port(dev->ds, port)) + return 0; - for (i = 0; i < dev->info->port_cnt; i++) - max_frame = max(max_frame, dev->ports[i].max_frame); + frame_size = mtu + VLAN_ETH_HLEN + ETH_FCS_LEN; return regmap_update_bits(dev->regmap[1], REG_SW_MTU__2, - REG_SW_MTU_MASK, max_frame); + REG_SW_MTU_MASK, frame_size); } static int ksz9477_wait_vlan_ctrl_ready(struct ksz_device *dev) diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h index 27c26ee15af4..61228be299f9 100644 --- a/drivers/net/dsa/microchip/ksz_common.h +++ b/drivers/net/dsa/microchip/ksz_common.h @@ -95,7 +95,6 @@ struct ksz_port { struct ksz_port_mib mib; phy_interface_t interface; - u16 max_frame; u32 rgmii_tx_val; u32 rgmii_rx_val; struct ksz_device *ksz_dev;