Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp523442pxm; Wed, 23 Feb 2022 05:40:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJxS/CYEjmg0eUzr6c4FPsHu+Qtn8D4p1q3832cbTmScCSRlZmrOW0G8nBAuTbZvGHw3xbQx X-Received: by 2002:a50:fe08:0:b0:40f:932a:47b0 with SMTP id f8-20020a50fe08000000b0040f932a47b0mr32090560edt.64.1645623619875; Wed, 23 Feb 2022 05:40:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645623619; cv=none; d=google.com; s=arc-20160816; b=O4t273IcjGakJ2jWhnJx2VtOWe6QEzlQeS3H1CzP3IR1G/8Wq1jlMBS3qR/9746jS3 xIQsS1dBWepbSsk97J+BZN3gModzlwsnqpMCgaSYLlLUQfD62ty1t+EOmFh9lAYVPFIA 5Hxh2l31cr14WDrIjRmKm7NgS1F6f1Xv7S5t8ioVQgovp98X2+USuV9IFlLenLuJnPly rdbH6XhYejzCdShfcPd0mprk9ipGmijFaoB47kx1D/svYatgZblDkoV+CzyXfj56I+7N 3hPLosTm8LpLAsTl+yKCEGLzg8zsxrbTtmszmWp/t0ExHnZAPeLhPvX7sklsSM4gADS0 mr0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=FbL/HGmqp/OuIGk5hyCSSbXmu71gfYbup80uLSEdycA=; b=QnZtl8YDeXislQwV5GMWmrcos+9ITIshGoXU8ryfEEhoFtgMWlh0k7eMBmjcBrn7ck Fp5iGO/xSiZxdYKeV3fRD9V/mpEPmxEyIVA4aMSawsLYY3ilWNmYJgzta06UQIqlm4BD /o4z070A0Foleao4s5pTyUTFSmw9eBt4bteK0ZErCtMVEpVpH13lg0ZXrthxe6M9sg81 7AcwQKsmpGXSmclDUaCLiU/aFp54NUee3RV7GPTEs00IF7Y/irxdqYFJi73uV/IhMVfq odolf7IQAhZVJHAh222MNHZ2gDf3avhDmgDhW3FSbsL5Fj0YIZ0v3/kv9Yc4zbAXtLDO MSRw== 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 j5si11566873ejo.379.2022.02.23.05.39.56; Wed, 23 Feb 2022 05:40:19 -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 S232317AbiBWHyk (ORCPT + 99 others); Wed, 23 Feb 2022 02:54:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238776AbiBWHyj (ORCPT ); Wed, 23 Feb 2022 02:54:39 -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 31933580D0 for ; Tue, 22 Feb 2022 23:54:12 -0800 (PST) Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nMmTN-0006ga-Gz; Wed, 23 Feb 2022 08:54:05 +0100 Received: from ore by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1nMmTM-00024F-Bo; Wed, 23 Feb 2022 08:54:04 +0100 Date: Wed, 23 Feb 2022 08:54:04 +0100 From: Oleksij Rempel To: Jakub Kicinski Cc: Woojung Huh , Andrew Lunn , Florian Fainelli , "David S. Miller" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, UNGLinuxDriver@microchip.com, kernel@pengutronix.de, Vladimir Oltean , Vivien Didelot Subject: Re: [PATCH net-next v1 1/1] net: dsa: microchip: ksz9477: implement MTU configuration Message-ID: <20220223075404.GA4594@pengutronix.de> References: <20220221084328.3661250-1-o.rempel@pengutronix.de> <20220222165217.62426462@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220222165217.62426462@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 08:44:25 up 74 days, 16:30, 83 users, load average: 0.16, 0.16, 0.17 User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 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,T_SCC_BODY_TEXT_LINE 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 On Tue, Feb 22, 2022 at 04:52:17PM -0800, Jakub Kicinski wrote: > On Mon, 21 Feb 2022 09:43:28 +0100 Oleksij Rempel wrote: > > This chips supports two ways to configure max MTU size: > > - by setting SW_LEGAL_PACKET_DISABLE bit: if this bit is 0 allowed packed size > > will be between 64 and bytes 1518. If this bit is 1, it will accept > > packets up to 2000 bytes. > > - by setting SW_JUMBO_PACKET bit. If this bit is set, the chip will > > ignore SW_LEGAL_PACKET_DISABLE value and use REG_SW_MTU__2 register to > > configure MTU size. > > > > Current driver has disabled SW_JUMBO_PACKET bit and activates > > SW_LEGAL_PACKET_DISABLE. So the switch will pass all packets up to 2000 without > > any way to configure it. > > > > By providing port_change_mtu we are switch to SW_JUMBO_PACKET way and will > > be able to configure MTU up to ~9000. > > And it has no negative side affects to always have jumbo enabled? > Maybe the internal buffer will be carved up in a different way? Hm I tested it with iperf3 on 4 of 7 ports on this switch without noticeable changes before and after this patch. My setup looks as following: ----` | /- iperf -s = port0 | \- iperf3 -c 172.17.0.11 -t 100 | | = port1 ... same as port0, ... -c 172.17.0.10 = port2 ... same as port0, ... -c 172.17.0.13 = port3 ... same as port0, ... -c 172.17.0.12 Each port was sending and receiving. Each instance reported 938 Mbits/sec > > +static int ksz9477_change_mtu(struct dsa_switch *ds, int port, int mtu) > > +{ > > + struct ksz_device *dev = ds->priv; > > + u16 new_mtu, max_mtu = 0; > > + int i; > > + > > + new_mtu = mtu + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN; > > + > > + if (dsa_is_cpu_port(ds, port)) > > + new_mtu += KSZ9477_INGRESS_TAG_LEN; > > + > > + /* Cache the per-port MTU setting */ > > + dev->ports[port].max_mtu = new_mtu; > > + > > + for (i = 0; i < dev->port_cnt; i++) { > > + if (dev->ports[i].max_mtu > max_mtu) > > + max_mtu = dev->ports[i].max_mtu; > > + } > > nit: > > for (...) > max_mtu = max(max_mtu, dev->ports[i].max_mtu) > > > @@ -41,6 +41,7 @@ struct ksz_port { > > > > struct ksz_port_mib mib; > > phy_interface_t interface; > > + unsigned int max_mtu; > > }; > > max_mtu already has two meanings in this patch, let's call this > max_frame or max_len etc, instead of adding a third meaning. Ok, thx. Will update the patch. Regards, Oleksij -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |