From patchwork Thu Nov 10 12:22:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksij Rempel X-Patchwork-Id: 18108 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp112785wru; Thu, 10 Nov 2022 04:25:58 -0800 (PST) X-Google-Smtp-Source: AMsMyM5y5EKIQVzq9alkkVQQ6DOEMKLm5rqY4ttwRFNGawLdrmLaiBndPaQPH7ixJMm0RATyxtyC X-Received: by 2002:a17:90a:e7c5:b0:213:b7d8:1c4c with SMTP id kb5-20020a17090ae7c500b00213b7d81c4cmr63892424pjb.114.1668083158431; Thu, 10 Nov 2022 04:25:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668083158; cv=none; d=google.com; s=arc-20160816; b=oIC2lvYCj9Ypiotmh1VDOlAGJktzGvC2Io8QEOMsjtOYUeLZkpFJWfNfaJ4Esc//yk sViKnAY9ly/FialgihYWB4RGePMb/aMBvCZD8W+uJOgaxfQLUgSH9WtHhornEbhGWWsO tPXjjri9A3YtG+DhCIseqeAO7xJHfo4THd/awBTROgHCEXxzCdVueZbsyuCcCXsCdHoU Zwe7o9AagH1P/1cXTMhuZ6ZL94eoNNrKZ1B5olMCXumJq30tiNEBrVT/S/02YTjVwSwF Cboog82n4pEzTuu1Zm5Xlr3jXfkcV4cF1xMPSrnh8ovAclulVG5a9jIiaYC2Wa5JraTr Nsgg== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g14-20020a63f40e000000b0045b22d763a3si20784552pgi.483.2022.11.10.04.25.44; Thu, 10 Nov 2022 04:25:58 -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 + 99 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 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?1749111965989171188?= X-GMAIL-MSGID: =?utf-8?q?1749111965989171188?= 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;