Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp616936rwb; Thu, 10 Nov 2022 05:27:25 -0800 (PST) X-Google-Smtp-Source: AMsMyM6paV2f7UXOT2smp5B/UAFhLxh+cf/JfyLhle1tn1MD/LaCRwLpugdudAWtCnAVsnOMI8cY X-Received: by 2002:a05:6402:50d4:b0:461:e349:56b2 with SMTP id h20-20020a05640250d400b00461e34956b2mr64296180edb.17.1668086845012; Thu, 10 Nov 2022 05:27:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668086845; cv=none; d=google.com; s=arc-20160816; b=iePsi2PmA+07UD9VxvCYfTH4DV5YQU5iz102O46+fPrMHnvOPU53en1ScpL+PzeB9y yozjC1R5ZjVMJ3nLRzllEJMYzPr6B/s6o72kE1vRgSmsOym5bu02pvBgl8guxKcfljuU P8jLYPIRzBlzXrXiWrbupFRIS/bVTWyeAjaL604h6SLmmM/heSUg7lGIPPlKhIZSV9PA vVok7Xybxbx5OznzsXwmYrsFd7ruintv+ctU+ajvyJmLL7P+E7fost+OX3C+i+YDnWja 47BYQKedZaYrTljhaeZViYVBVfEfStKe8Xi+Roe+GBj3l9vGG1JP9fAphPUgsWXfnOHF iNzg== 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=nGIb5uztQO4I/HAmavZ/CThWbATFNxWUQbvv5/YN/V8=; b=yO1GCVQb2jPdHqs7Kiy6QpKCbMPiHtO++2rYMZfUi+1OUAEE7Jn6CrgX0nlmdhoqBa 8Z0saZ174qcNZPElvd8y0m57MGPPfT5K2IcdCmEtMljOT4UZo+J8BXS8nuECGIr3Jcix RfT6RjP2z13TuJY6FIHAup1N/t9mOCTKg5sJtxn6B1JeZ0NwftTHZVMwxwW5IbXsduMu kR2cEXKaWtUiq+UQEl9TJ+u2EMpZlZYm8+fuD2hStUXs+6Cxr4DBFVlDs+Y5nkWclClP UgvnID0FJ76P24dtRCRFTD5QOwKawDVM3cJo5sTwz5IqfRrpTd9XFmFIIxZIJcT2Do0x 5XnQ== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l13-20020a170906794d00b007ae6ba5f344si13480599ejo.53.2022.11.10.05.27.00; Thu, 10 Nov 2022 05:27:24 -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 S230305AbiKJMYH (ORCPT + 92 others); Thu, 10 Nov 2022 07:24:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229568AbiKJMXl (ORCPT ); Thu, 10 Nov 2022 07:23:41 -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 ABF597832C for ; Thu, 10 Nov 2022 04:22:50 -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 1ot6Zh-0000GU-Af; Thu, 10 Nov 2022 13:22: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 1ot6Zd-003RqJ-T6; Thu, 10 Nov 2022 13:22:26 +0100 Received: from ore by dude04.red.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1ot6Ze-005NtL-34; Thu, 10 Nov 2022 13:22:26 +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 v4 2/4] net: dsa: microchip: do not store max MTU for all ports Date: Thu, 10 Nov 2022 13:22:23 +0100 Message-Id: <20221110122225.1283326-3-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221110122225.1283326-1-o.rempel@pengutronix.de> References: <20221110122225.1283326-1-o.rempel@pengutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 If we have global MTU configuration, it is enough to configure it on CPU port only. Signed-off-by: Oleksij Rempel --- 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; -- 2.30.2