From patchwork Wed Nov 23 11:26:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksij Rempel X-Patchwork-Id: 24920 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2732132wrr; Wed, 23 Nov 2022 03:33:53 -0800 (PST) X-Google-Smtp-Source: AA0mqf4CVlj3P2ZkAE8xu5l2V+EtusffI0GLKqtC6eve6fgDUO+OACkMiwYFqRT698CeNRQOyvsW X-Received: by 2002:a17:903:31cd:b0:180:be71:6773 with SMTP id v13-20020a17090331cd00b00180be716773mr8504206ple.42.1669203233435; Wed, 23 Nov 2022 03:33:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669203233; cv=none; d=google.com; s=arc-20160816; b=Owgsc4l39NIOnAWTz0rxe98DJ+i8J/YE+IppAJ+fo4RT1VgKCjcYZy33BsOutWQzuT Y5wLee2CIXNmajxR+oncIHadh+pe06YCmE3ZKhG7lh7Jb9z2jjsUBHC7S9jvzZxURhgS MSbSzicIUIdh512yjJ1udrqK1tQfx/HPoPzZcZp673DEA1heWWai1oF5+F4QUPDidhZZ xcv4SYZzYi/vYnXnnrBKzsTnGpwA7SIimC1H0nf9wXLxsNgY5b/NpztnqJyE2B+VfMsv UT/2my75RFYyCn/yeKKUDVMKE6XA2sAAdgXMIjAyI/GdLEitCRBH39X70DyoOghf3I0Y Pmgg== 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=pOYdlhSMbycz1Aq+Rln+44x90vVy4uSk866fH5swCSM=; b=VmT2J7Ijb1+Cr2x5LzZyPAbzoxNNGAtdREcco2iJ95oeHsaiBOHnvIwKNtciaEEO2K jlm3Ivfh+cUgksbbP9430IqROstVrpuuBVOuVx1t5g3vV+/XUVnAMcs4lmHYO200al09 SaOA2RdSY1EDI4d1hP0tWeXIGMoyVhVerJ06LkBzznqKTouKIL9hyic4Y8KHxoAJZfKT JRzEDLqawTHqb7kpHyC/l54fKKnpMmpr4xHoqkIcBxyOquoU2PiWnXRVXghcpfLtPnCC SU59kFcKZVrnW4/cxt6xTgBinYTpmcaZ7a9g1zLK5LTqiEvXALfa62QUeXbWzq6vek4M BJGw== 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 t4-20020a056a0021c400b0056bc9b188c6si16806160pfj.245.2022.11.23.03.33.40; Wed, 23 Nov 2022 03:33:53 -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 S236966AbiKWL1L (ORCPT + 99 others); Wed, 23 Nov 2022 06:27:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234936AbiKWL0k (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 47BD07C47E 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-0003vo-Hg; 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-0062RH-FR; 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 1oxnta-008jqb-Vt; Wed, 23 Nov 2022 12:26: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 , Arun Ramadoss , kernel@pengutronix.de, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Arun.Ramadoss@microchip.com Subject: [PATCH net-next v5 1/5] net: dsa: microchip: move max mtu to one location Date: Wed, 23 Nov 2022 12:26:21 +0100 Message-Id: <20221123112625.2082797-2-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?1750286449720797605?= X-GMAIL-MSGID: =?utf-8?q?1750286449720797605?= There are no HW specific registers, so we can process all of them in one location. Signed-off-by: Oleksij Rempel Tested-by: Arun Ramadoss (KSZ9893 and LAN937x) --- drivers/net/dsa/microchip/ksz9477.c | 5 ----- drivers/net/dsa/microchip/ksz9477.h | 1 - drivers/net/dsa/microchip/ksz9477_reg.h | 2 -- drivers/net/dsa/microchip/ksz_common.c | 22 +++++++++++++++++----- drivers/net/dsa/microchip/ksz_common.h | 3 ++- 5 files changed, 19 insertions(+), 14 deletions(-) diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c index 0d6b40968657..602d00671bef 100644 --- a/drivers/net/dsa/microchip/ksz9477.c +++ b/drivers/net/dsa/microchip/ksz9477.c @@ -60,11 +60,6 @@ int ksz9477_change_mtu(struct ksz_device *dev, int port, int mtu) REG_SW_MTU_MASK, max_frame); } -int ksz9477_max_mtu(struct ksz_device *dev, int port) -{ - return KSZ9477_MAX_FRAME_SIZE - VLAN_ETH_HLEN - ETH_FCS_LEN; -} - static int ksz9477_wait_vlan_ctrl_ready(struct ksz_device *dev) { unsigned int val; diff --git a/drivers/net/dsa/microchip/ksz9477.h b/drivers/net/dsa/microchip/ksz9477.h index 00862c4cfb7f..7c5bb3032772 100644 --- a/drivers/net/dsa/microchip/ksz9477.h +++ b/drivers/net/dsa/microchip/ksz9477.h @@ -50,7 +50,6 @@ int ksz9477_mdb_add(struct ksz_device *dev, int port, int ksz9477_mdb_del(struct ksz_device *dev, int port, const struct switchdev_obj_port_mdb *mdb, struct dsa_db db); int ksz9477_change_mtu(struct ksz_device *dev, int port, int mtu); -int ksz9477_max_mtu(struct ksz_device *dev, int port); void ksz9477_config_cpu_port(struct dsa_switch *ds); int ksz9477_enable_stp_addr(struct ksz_device *dev); int ksz9477_reset_switch(struct ksz_device *dev); diff --git a/drivers/net/dsa/microchip/ksz9477_reg.h b/drivers/net/dsa/microchip/ksz9477_reg.h index 53c68d286dd3..cc457fa64939 100644 --- a/drivers/net/dsa/microchip/ksz9477_reg.h +++ b/drivers/net/dsa/microchip/ksz9477_reg.h @@ -1615,6 +1615,4 @@ #define PTP_TRIG_UNIT_M (BIT(MAX_TRIG_UNIT) - 1) #define PTP_TS_UNIT_M (BIT(MAX_TIMESTAMP_UNIT) - 1) -#define KSZ9477_MAX_FRAME_SIZE 9000 - #endif /* KSZ9477_REGS_H */ diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c index 8c8db315317d..49a5a236d958 100644 --- a/drivers/net/dsa/microchip/ksz_common.c +++ b/drivers/net/dsa/microchip/ksz_common.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -206,7 +207,6 @@ static const struct ksz_dev_ops ksz9477_dev_ops = { .mdb_add = ksz9477_mdb_add, .mdb_del = ksz9477_mdb_del, .change_mtu = ksz9477_change_mtu, - .max_mtu = ksz9477_max_mtu, .phylink_mac_link_up = ksz9477_phylink_mac_link_up, .config_cpu_port = ksz9477_config_cpu_port, .enable_stp_addr = ksz9477_enable_stp_addr, @@ -243,7 +243,6 @@ static const struct ksz_dev_ops lan937x_dev_ops = { .mdb_add = ksz9477_mdb_add, .mdb_del = ksz9477_mdb_del, .change_mtu = lan937x_change_mtu, - .max_mtu = ksz9477_max_mtu, .phylink_mac_link_up = ksz9477_phylink_mac_link_up, .config_cpu_port = lan937x_config_cpu_port, .enable_stp_addr = ksz9477_enable_stp_addr, @@ -2500,10 +2499,23 @@ static int ksz_max_mtu(struct dsa_switch *ds, int port) { struct ksz_device *dev = ds->priv; - if (!dev->dev_ops->max_mtu) - return -EOPNOTSUPP; + switch (dev->chip_id) { + case KSZ8563_CHIP_ID: + case KSZ9477_CHIP_ID: + case KSZ9563_CHIP_ID: + case KSZ9567_CHIP_ID: + case KSZ9893_CHIP_ID: + case KSZ9896_CHIP_ID: + case KSZ9897_CHIP_ID: + case LAN9370_CHIP_ID: + case LAN9371_CHIP_ID: + case LAN9372_CHIP_ID: + case LAN9373_CHIP_ID: + case LAN9374_CHIP_ID: + return KSZ9477_MAX_FRAME_SIZE - VLAN_ETH_HLEN - ETH_FCS_LEN; + } - return dev->dev_ops->max_mtu(dev, port); + return -EOPNOTSUPP; } static void ksz_set_xmii(struct ksz_device *dev, int port, diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h index c6726cbd5465..27c26ee15af4 100644 --- a/drivers/net/dsa/microchip/ksz_common.h +++ b/drivers/net/dsa/microchip/ksz_common.h @@ -322,7 +322,6 @@ struct ksz_dev_ops { void (*get_caps)(struct ksz_device *dev, int port, struct phylink_config *config); int (*change_mtu)(struct ksz_device *dev, int port, int mtu); - int (*max_mtu)(struct ksz_device *dev, int port); void (*freeze_mib)(struct ksz_device *dev, int port, bool freeze); void (*port_init_cnt)(struct ksz_device *dev, int port); void (*phylink_mac_config)(struct ksz_device *dev, int port, @@ -588,6 +587,8 @@ static inline int is_lan937x(struct ksz_device *dev) #define PORT_SRC_PHY_INT 1 +#define KSZ9477_MAX_FRAME_SIZE 9000 + /* Regmap tables generation */ #define KSZ_SPI_OP_RD 3 #define KSZ_SPI_OP_WR 2 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; From patchwork Wed Nov 23 11:26: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: 24923 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2732236wrr; Wed, 23 Nov 2022 03:34:08 -0800 (PST) X-Google-Smtp-Source: AA0mqf6P/AGuV7bqzETtSxWQ6r98ymvmw4mkpXEKgIhmQiQiyJjstHg/5gGNYMjBAnvxJOeMaAqr X-Received: by 2002:a17:906:6d88:b0:7ad:b86b:3ff with SMTP id h8-20020a1709066d8800b007adb86b03ffmr24406738ejt.448.1669203248092; Wed, 23 Nov 2022 03:34:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669203248; cv=none; d=google.com; s=arc-20160816; b=Ews0Geby1SuRb5Rmddw46QkLFl/L5X42KPmxJ77JDL1KwLxEpAbOLcMhlxE8UpgYyd dOx//4Q7xKMr/EyR/ZvrcP8K+/QOajKOLAsFHYkwu9Ag8hinTBVtRicvHloSPfunw53t ALHMM5MdwMFdN2pVYyXv8uBac8q+ygK9LbsqReyCqX7pGX1z5zj4g1px7d12PMohpUIi TZi85Z3WP4+F5kKNzVZELR6Sbr+mBI8VxujyhNI/QfXz3j67DTvcakG8Wgg2ZBIxVr2m 8ffPbqQ+4WPjAOsI09Bb5Ew8LYDXIDYq+VGE/QY5aRxFzlzUQbcxKMxNpFjoafYxuMIl 6J0g== 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=iK5cN8ByIGaChYdijyCtpN9KKl5RJzFpP5av/reYnKY=; b=LCLCoRnI+0CpMHR/l+szLeI+Oa9ExJixcqeF2qYQiA73dpEK9hmxRZsgoCt7i6oTyL KuPNTset6cBC4tT9q4dTbqY2ZGMgYpUoRcJIn5PdiifCvyJOef653gOLorkk1KVjVAnN 7SNVSMFzwGddcL0av/bmoOth3+yAXgNW2P5W7BJKX5AJdB7tWCOKXwCkSwUBwQDMOhgG Xn0LfN2mJZXkdoaeIhRwZthfGxG7D703qxJomwOjG/ngH0FkuYO5hHZMWrRf14C42cwW peDKuz/vVF7+7rnpHqRoWVh20MEExU1C5qNL0hB9NgGDLAk8H+vokLmycZgzXWRzFH/l odZg== 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 fj17-20020a0564022b9100b0045928479b71si13037285edb.405.2022.11.23.03.33.44; Wed, 23 Nov 2022 03:34:08 -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 S237347AbiKWL1P (ORCPT + 99 others); Wed, 23 Nov 2022 06:27:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236367AbiKWL0l (ORCPT ); Wed, 23 Nov 2022 06:26: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 E7EB8ED5F0 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-0003vp-Hd; 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-0062RI-Fq; 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-008jqt-7E; 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 , Arun Ramadoss , kernel@pengutronix.de, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Arun.Ramadoss@microchip.com Subject: [PATCH net-next v5 3/5] net: dsa: microchip: add ksz_rmw8() function Date: Wed, 23 Nov 2022 12:26:23 +0100 Message-Id: <20221123112625.2082797-4-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?1750286464854524001?= X-GMAIL-MSGID: =?utf-8?q?1750286464854524001?= Add ksz_rmw8(), it will be used in the next patch. Signed-off-by: Oleksij Rempel Acked-by: Arun Ramadoss Reviewed-by: Florian Fainelli --- drivers/net/dsa/microchip/ksz_common.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h index 61228be299f9..5f404a444ce1 100644 --- a/drivers/net/dsa/microchip/ksz_common.h +++ b/drivers/net/dsa/microchip/ksz_common.h @@ -454,6 +454,11 @@ static inline int ksz_write64(struct ksz_device *dev, u32 reg, u64 value) return regmap_bulk_write(dev->regmap[2], reg, val, 2); } +static inline int ksz_rmw8(struct ksz_device *dev, int offset, u8 mask, u8 val) +{ + return regmap_update_bits(dev->regmap[0], offset, mask, val); +} + static inline int ksz_pread8(struct ksz_device *dev, int port, int offset, u8 *data) { From patchwork Wed Nov 23 11:26:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksij Rempel X-Patchwork-Id: 24922 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2732157wrr; Wed, 23 Nov 2022 03:33:58 -0800 (PST) X-Google-Smtp-Source: AA0mqf6GyWcA/Prm++dkaUQZhvdBkiTaaEZowVQKUz9INcVeh5yX4loSu3I+bPn5bDmpJHdZ9YL6 X-Received: by 2002:a17:907:c20d:b0:7b8:882d:43fc with SMTP id ti13-20020a170907c20d00b007b8882d43fcmr6200849ejc.0.1669203238192; Wed, 23 Nov 2022 03:33:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669203238; cv=none; d=google.com; s=arc-20160816; b=jHdk4q7iXXrQ32lKFZmiQ/JOKOvbWqtpHXFEJMcTCykYPu9NeqyE5JwZ6fLDH15s7V SIaqGRvLGDUXxztYYh2pNJdgoZh31NJFgvTe/jIz+UqQX+81IXnrBO+vdUVJ1bf8xa0t ryXqQ0K2PwrRMSGk1z4pQmuRtuGJchWVo/DzrqAU9Ckl5phbUH6nlkQaVk1UCM6MV2+F wBXv2D/jZpo5kIOpFIJlsyv/oxwRdQhbz1kzGgBYE3IrHDMVv5FK3NxrKpqrAFqTE3F5 LxSVeBd8maZ+DPiIUZExyMpUTttdbucMgAzoBJa7k3YnTB4n18NUKLbfOUKcSp5wW8iF VoiQ== 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=y1HuZCrWAD0Lyp7v/Xrdsl3KoOPsY6yJS07EQ9APa6o=; b=KI6oyjRrq2zlSNFOCSdijDpPwKrrl5B7ScU1ChNpmIFPrvu1MYtlETbU0qVdu/rSmP lIYy4D3Jfj1Gq/auC4r36MfdvH8OkF4VTqTg/SZO/1ODwJCiQHOfVyngVNnDHuN5/ZtS Iy+XV9UzkMAubSv2MQcrWR4LEBIDungsrYChH5AzOHXKhiC117m8VuQVenIPGpGLdA0F 5CDM5jVbvxcxSAlumli2TAydqOQdwv77AFiLpw04bWc38Ao8zuv2HTATf7ddXuOrnssT s1JbgjGRRhjmzfC92i/lb07eQHjDyXsx/pzNbr4bCZsHhS30lLUMqbfShGcydqk3H5T8 zQ3w== 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 dn8-20020a17090794c800b0078db6f488c2si15050523ejc.56.2022.11.23.03.33.34; Wed, 23 Nov 2022 03:33: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 S236872AbiKWL1I (ORCPT + 99 others); Wed, 23 Nov 2022 06:27:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235751AbiKWL0k (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 46E067C02B 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-0003w0-Hf; 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-0062RS-MP; 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-008jr2-BE; 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 , Arun Ramadoss , kernel@pengutronix.de, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Arun.Ramadoss@microchip.com Subject: [PATCH net-next v5 4/5] net: dsa: microchip: ksz8: add MTU configuration support Date: Wed, 23 Nov 2022 12:26:24 +0100 Message-Id: <20221123112625.2082797-5-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?1750286454610242334?= X-GMAIL-MSGID: =?utf-8?q?1750286454610242334?= Make MTU configurable on KSZ87xx and KSZ88xx series of switches. Before this patch, pre-configured behavior was different on different switch series, due to opposite meaning of the same bit: - KSZ87xx: Reg 4, Bit 1 - if 1, max frame size is 1532; if 0 - 1514 - KSZ88xx: Reg 4, Bit 1 - if 1, max frame size is 1514; if 0 - 1532 Since the code was telling "... SW_LEGAL_PACKET_DISABLE, true)", I assume, the idea was to set max frame size to 1532. With this patch, by setting MTU size 1500, both switch series will be configured to the 1532 frame limit. This patch was tested on KSZ8873. Signed-off-by: Oleksij Rempel Acked-by: Arun Ramadoss Reviewed-by: Vladimir Oltean Reviewed-by: Florian Fainelli --- drivers/net/dsa/microchip/ksz8.h | 1 + drivers/net/dsa/microchip/ksz8795.c | 53 ++++++++++++++++++++++++- drivers/net/dsa/microchip/ksz8795_reg.h | 3 ++ drivers/net/dsa/microchip/ksz_common.c | 7 ++++ drivers/net/dsa/microchip/ksz_common.h | 4 ++ 5 files changed, 66 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/microchip/ksz8.h b/drivers/net/dsa/microchip/ksz8.h index 8582b4b67d98..ea05abfbd51d 100644 --- a/drivers/net/dsa/microchip/ksz8.h +++ b/drivers/net/dsa/microchip/ksz8.h @@ -57,5 +57,6 @@ int ksz8_reset_switch(struct ksz_device *dev); int ksz8_switch_detect(struct ksz_device *dev); int ksz8_switch_init(struct ksz_device *dev); void ksz8_switch_exit(struct ksz_device *dev); +int ksz8_change_mtu(struct ksz_device *dev, int port, int mtu); #endif diff --git a/drivers/net/dsa/microchip/ksz8795.c b/drivers/net/dsa/microchip/ksz8795.c index bd3b133e7085..d01bfd609130 100644 --- a/drivers/net/dsa/microchip/ksz8795.c +++ b/drivers/net/dsa/microchip/ksz8795.c @@ -76,6 +76,57 @@ int ksz8_reset_switch(struct ksz_device *dev) return 0; } +static int ksz8863_change_mtu(struct ksz_device *dev, int frame_size) +{ + u8 ctrl2 = 0; + + if (frame_size <= KSZ8_LEGAL_PACKET_SIZE) + ctrl2 |= KSZ8863_LEGAL_PACKET_ENABLE; + else if (frame_size > KSZ8863_NORMAL_PACKET_SIZE) + ctrl2 |= KSZ8863_HUGE_PACKET_ENABLE; + + return ksz_rmw8(dev, REG_SW_CTRL_2, KSZ8863_LEGAL_PACKET_ENABLE | + KSZ8863_HUGE_PACKET_ENABLE, ctrl2); +} + +static int ksz8795_change_mtu(struct ksz_device *dev, int frame_size) +{ + u8 ctrl1 = 0, ctrl2 = 0; + int ret; + + if (frame_size > KSZ8_LEGAL_PACKET_SIZE) + ctrl2 |= SW_LEGAL_PACKET_DISABLE; + else if (frame_size > KSZ8863_NORMAL_PACKET_SIZE) + ctrl1 |= SW_HUGE_PACKET; + + ret = ksz_rmw8(dev, REG_SW_CTRL_1, SW_HUGE_PACKET, ctrl1); + if (ret) + return ret; + + return ksz_rmw8(dev, REG_SW_CTRL_2, SW_LEGAL_PACKET_DISABLE, ctrl2); +} + +int ksz8_change_mtu(struct ksz_device *dev, int port, int mtu) +{ + u16 frame_size; + + if (!dsa_is_cpu_port(dev->ds, port)) + return 0; + + frame_size = mtu + VLAN_ETH_HLEN + ETH_FCS_LEN; + + switch (dev->chip_id) { + case KSZ8795_CHIP_ID: + case KSZ8794_CHIP_ID: + case KSZ8765_CHIP_ID: + return ksz8795_change_mtu(dev, frame_size); + case KSZ8830_CHIP_ID: + return ksz8863_change_mtu(dev, frame_size); + } + + return -EOPNOTSUPP; +} + static void ksz8795_set_prio_queue(struct ksz_device *dev, int port, int queue) { u8 hi, lo; @@ -1233,8 +1284,6 @@ void ksz8_config_cpu_port(struct dsa_switch *ds) masks = dev->info->masks; regs = dev->info->regs; - /* Switch marks the maximum frame with extra byte as oversize. */ - ksz_cfg(dev, REG_SW_CTRL_2, SW_LEGAL_PACKET_DISABLE, true); ksz_cfg(dev, regs[S_TAIL_TAG_CTRL], masks[SW_TAIL_TAG_ENABLE], true); p = &dev->ports[dev->cpu_port]; diff --git a/drivers/net/dsa/microchip/ksz8795_reg.h b/drivers/net/dsa/microchip/ksz8795_reg.h index 77487d611824..7a57c6088f80 100644 --- a/drivers/net/dsa/microchip/ksz8795_reg.h +++ b/drivers/net/dsa/microchip/ksz8795_reg.h @@ -48,6 +48,9 @@ #define NO_EXC_COLLISION_DROP BIT(3) #define SW_LEGAL_PACKET_DISABLE BIT(1) +#define KSZ8863_HUGE_PACKET_ENABLE BIT(2) +#define KSZ8863_LEGAL_PACKET_ENABLE BIT(1) + #define REG_SW_CTRL_3 0x05 #define WEIGHTED_FAIR_QUEUE_ENABLE BIT(3) diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c index 49a5a236d958..f39b041765fb 100644 --- a/drivers/net/dsa/microchip/ksz_common.c +++ b/drivers/net/dsa/microchip/ksz_common.c @@ -172,6 +172,7 @@ static const struct ksz_dev_ops ksz8_dev_ops = { .reset = ksz8_reset_switch, .init = ksz8_switch_init, .exit = ksz8_switch_exit, + .change_mtu = ksz8_change_mtu, }; static void ksz9477_phylink_mac_link_up(struct ksz_device *dev, int port, @@ -2500,6 +2501,12 @@ static int ksz_max_mtu(struct dsa_switch *ds, int port) struct ksz_device *dev = ds->priv; switch (dev->chip_id) { + case KSZ8795_CHIP_ID: + case KSZ8794_CHIP_ID: + case KSZ8765_CHIP_ID: + return KSZ8795_HUGE_PACKET_SIZE - VLAN_ETH_HLEN - ETH_FCS_LEN; + case KSZ8830_CHIP_ID: + return KSZ8863_HUGE_PACKET_SIZE - VLAN_ETH_HLEN - ETH_FCS_LEN; case KSZ8563_CHIP_ID: case KSZ9477_CHIP_ID: case KSZ9563_CHIP_ID: diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h index 5f404a444ce1..cb27f5a180c7 100644 --- a/drivers/net/dsa/microchip/ksz_common.h +++ b/drivers/net/dsa/microchip/ksz_common.h @@ -591,6 +591,10 @@ static inline int is_lan937x(struct ksz_device *dev) #define PORT_SRC_PHY_INT 1 +#define KSZ8795_HUGE_PACKET_SIZE 2000 +#define KSZ8863_HUGE_PACKET_SIZE 1916 +#define KSZ8863_NORMAL_PACKET_SIZE 1536 +#define KSZ8_LEGAL_PACKET_SIZE 1518 #define KSZ9477_MAX_FRAME_SIZE 9000 /* Regmap tables generation */ From patchwork Wed Nov 23 11:26:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksij Rempel X-Patchwork-Id: 24924 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2732306wrr; Wed, 23 Nov 2022 03:34:17 -0800 (PST) X-Google-Smtp-Source: AA0mqf7N76KpD0pyb+Ne2dOjRebTAPVNGKfhZ5TJ/DkHR71PYIMgw4XxWuIMhTkDk8Hqm3Ky6dKJ X-Received: by 2002:a17:906:7848:b0:7ad:b286:72da with SMTP id p8-20020a170906784800b007adb28672damr23631077ejm.152.1669203257175; Wed, 23 Nov 2022 03:34:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669203257; cv=none; d=google.com; s=arc-20160816; b=fVx59OfWIdB+cfz+4Ep2M6C85IjT3dwzL3YNR462/x9qRXUXfzZNttrE48YwJUTbHz LDCMsgHGbSVR3gy0JXyAc9vTxb09sbULnJPDrriolawFZ5xKqsgOUFz5KRGM3kKhEfxl VEKlAe7bPnQtHBVQSJA0ax4n2dIVIJIxR4s+tCoJhhZ6zpqIuiKufhKC0FBBUUpFIl2k N8S6aycCAfhFRDmO6P20S1E/h4tLaoB/EQVsGzgznjKJ/a/SfOQBOV4RVz4YGRLat0NS jjTzMAjzgWd5coDTLqfMq7uo0FbvSMMb6zW5Xii2ppAwsWC1kM/yZvIpOdFKAdtw99zo Y/Dg== 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=bVPUjL+8Tj5i+GmnriF02stCg9CUsBvq2n3MOAxG4Ck=; b=bqxh+I5nfG1svldcFQXOSIZWM/dsdB+Mkp79hyL5sc0FmuQ2FJw9m7VaeC8gjzIwXN 1XixOGNBhsDCvWWqIfP7E/lpUCMeWcQKCRbp++vyRMzveKs9nlAYqkLVZ6ICLE4juDOd 0hU9Ov7SRlGF3Y+Ba1TWhUIRdeT/HKdBlMbNr0nUJm2ymLuZ7+z46guv1Z/8FNaFoTzm cxos1tkJw66fud6S4YsCzIhie2N8aV4tZ6wM/XnU4SQQH7y84RSFaAr2QQ95PbPheVc/ On64Znw/FcwYLnue4MYx9650AdLacLbhgUOmtAdFUAwZ+wwpYXJpBsdB//mMXGRQPXGN iAQw== 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 g40-20020a056402322800b004591f959c3bsi7400597eda.427.2022.11.23.03.33.53; Wed, 23 Nov 2022 03:34:17 -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 S237123AbiKWL1T (ORCPT + 99 others); Wed, 23 Nov 2022 06:27:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236323AbiKWL0k (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 58F06ED5FD 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-0003vq-Hc; 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-0062RP-J7; 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-008jrB-ET; 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 5/5] net: dsa: microchip: enable MTU normalization for KSZ8795 and KSZ9477 compatible switches Date: Wed, 23 Nov 2022 12:26:25 +0100 Message-Id: <20221123112625.2082797-6-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?1750286474463566665?= X-GMAIL-MSGID: =?utf-8?q?1750286474463566665?= KSZ8795 and KSZ9477 compatible series of switches use global max frame size configuration register. So, enable MTU normalization for this reason. Signed-off-by: Oleksij Rempel --- drivers/net/dsa/microchip/ksz8795.c | 2 ++ drivers/net/dsa/microchip/ksz9477.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/drivers/net/dsa/microchip/ksz8795.c b/drivers/net/dsa/microchip/ksz8795.c index d01bfd609130..d88d0b989e1a 100644 --- a/drivers/net/dsa/microchip/ksz8795.c +++ b/drivers/net/dsa/microchip/ksz8795.c @@ -1426,6 +1426,8 @@ int ksz8_switch_init(struct ksz_device *dev) */ dev->ds->vlan_filtering_is_global = true; + dev->ds->mtu_enforcement_ingress = true; + return 0; } diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c index f6e7968ab105..4fb07fbdf565 100644 --- a/drivers/net/dsa/microchip/ksz9477.c +++ b/drivers/net/dsa/microchip/ksz9477.c @@ -1134,6 +1134,8 @@ int ksz9477_setup(struct dsa_switch *ds) struct ksz_device *dev = ds->priv; int ret = 0; + dev->ds->mtu_enforcement_ingress = true; + /* Required for port partitioning. */ ksz9477_cfg32(dev, REG_SW_QM_CTRL__4, UNICAST_VLAN_BOUNDARY, true);