From patchwork Thu Nov 24 10:14:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksij Rempel X-Patchwork-Id: 25425 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3304723wrr; Thu, 24 Nov 2022 02:21:12 -0800 (PST) X-Google-Smtp-Source: AA0mqf4I2ABNsweABG+gDTzQByLOH73Zs3TAC1OFYomX78iEQm8sDu+llh4LaPGGklVl5ynkX7Tv X-Received: by 2002:a17:903:2144:b0:184:fa22:8b67 with SMTP id s4-20020a170903214400b00184fa228b67mr13393021ple.149.1669285272569; Thu, 24 Nov 2022 02:21:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669285272; cv=none; d=google.com; s=arc-20160816; b=aECYWn5EckT6Qm44DeSkqT0xOEKHt08IVbpYMUQeiTDtY8EhETdcMlZx1vdL+1s3zS o19G7JrXewkhjnMKA+1YnM1tJJ9Y6FPne8EMuGXX8PxVDM/Ep1NzTxhC/7AleAVC8gBO KJCsnQ1JQ2gBmhGr8Ur2LMWr/++zUP6bp3asyfjNBqTKvW7o5V7MGVBb572j2JSvpTJ8 HJM1asaVJDTxcQC/LwPhAZKoTUkqQf6QteQgIWsKp9COGSk+pYohA9zhRaei0TwwLnla AARPODud1r5ARXTm04wo5M2kJohBO3xvHCcQAc4yaAApmW3Kyqcvp5w5cx982SMjKjlX gmGg== 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=cC3nlRRoI/4VzR68gQE+A1gpRM68knZaO6vZ/H1ttPCLSuYeJxKDoXKjP7EQcBjXxr maVJPjlIJLpj2a+hxewaiFBTy/V9/zxyidtmcncnYkt7dPRy7UmHoNnQoCZHkKzmbfha bk7fK3Zp97RsR7e12eP6GoH8Fm9bqxDC5asPSqTuq6MmekI8ryhrGXljAMu6aOSXeKJz pciGXslpl0aI/VZKS0EQwuD3qvYGRzPckauTR9b9PklKjCafAcmM/OBa0SEu6+HAAgQ2 VphAWB+AAz5bMXQgP1nvbspCM4yC7/lI/LAitJGlgaJ2Be9o89JGBJsSRFdy4Z9WIpCE belQ== 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 bc3-20020a170902930300b0018930d070bdsi654978plb.72.2022.11.24.02.20.59; Thu, 24 Nov 2022 02:21:12 -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 S229963AbiKXKPP (ORCPT + 99 others); Thu, 24 Nov 2022 05:15:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229803AbiKXKPN (ORCPT ); Thu, 24 Nov 2022 05:15:13 -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 BAE11C1F73 for ; Thu, 24 Nov 2022 02:15:12 -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 1oy9G4-0004Ie-1x; Thu, 24 Nov 2022 11:15:04 +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 1oy9G0-0000jX-Dp; Thu, 24 Nov 2022 11:15:01 +0100 Received: from ore by dude04.red.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1oy9Fz-00E4WX-L8; Thu, 24 Nov 2022 11:14:59 +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 v6 2/6] net: dsa: microchip: do not store max MTU for all ports Date: Thu, 24 Nov 2022 11:14:54 +0100 Message-Id: <20221124101458.3353902-3-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221124101458.3353902-1-o.rempel@pengutronix.de> References: <20221124101458.3353902-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?1750372473974166062?= X-GMAIL-MSGID: =?utf-8?q?1750372473974166062?= 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;