Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1579205pxm; Thu, 24 Feb 2022 05:54:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJzd9zy+lDf23TQT+UbZm0du0V255F4z5LNA/Dq5dGXY2CwUf3E7sHMaSMZ4MLfRHWVd0ynZ X-Received: by 2002:a50:9d8a:0:b0:410:d303:8af5 with SMTP id w10-20020a509d8a000000b00410d3038af5mr2343668ede.371.1645710843393; Thu, 24 Feb 2022 05:54:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645710843; cv=none; d=google.com; s=arc-20160816; b=bxeSCVyiHf9WNmg2am7pvIXWGjFBJGadD1AJHWOEZ07VbRio+kiOHGsOdOhC4GAEnr 7MMwAyW0EfSLvj4NFF+eSkivw60k7NYEwKf0cTFgKof1IMbbLUxHdKMl/i87dHtVLn+N FdhNWeAqB+9V97In2GVk0XkcECamzjvLTVISemgJOEU2FT4D/aPYHFBJY2lfr7zd9fxq RwLN2yrZUwUHzKd4xskbixghE4Z2EB9QuRSNU+VR7uBhVetbBhB8a5Y1pdi/6JfCZlJN LPfIqwxFF2HTfSEBz6GV1CnNUF83gl5vW3R0sv8f9Sz0Lh8VPSQ6DvkBPLaS3G376jnE cQ4w== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=3DZRoht9CY5Ts3gfyAyvGSe595gvVKunFN66PrfR+zg=; b=fSKF+qzZe4nW93Ny4sfm/GBwU4WfWCMMg5hIZPGqyYcAR1Rfok2VrUvKt9HKryXMeu sIA0ijCbYyj+qzOqwioCcDnzF+W/cFidvK95hpa46H0OVwinr2QRg7pdh0dCXkyiikUk YCPzFzUcLpGS/tAPuKa3rGK85QIworPWJMmlSnWaCXBgjw2m+TIJvpsLksKFMdE2Iv+Z muscx8D9AymOVqKYCZYAOe5TF6YQe+FTUbgGv1aM3eM6qpE7ea1GrcdhQ7vyNblF1PFn IfD/hnYBlkoAGwkfAho1PnabBC6yLRu90jrRuxR765OQ40JsPqjo51KDE8TeZCR0cyyr OQfg== 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 t5si1853960edd.190.2022.02.24.05.53.38; Thu, 24 Feb 2022 05:54:03 -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 S232937AbiBXJjC (ORCPT + 99 others); Thu, 24 Feb 2022 04:39:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232933AbiBXJjA (ORCPT ); Thu, 24 Feb 2022 04:39:00 -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 01A6827AFEB for ; Thu, 24 Feb 2022 01:38:31 -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 1nNAZw-0007AX-SJ; Thu, 24 Feb 2022 10:38:28 +0100 Received: from ore by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1nNAZv-0005M2-72; Thu, 24 Feb 2022 10:38:27 +0100 Date: Thu, 24 Feb 2022 10:38:27 +0100 From: Oleksij Rempel To: Vladimir Oltean Cc: Woojung Huh , Andrew Lunn , Florian Fainelli , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Vivien Didelot , kernel@pengutronix.de, Jakub Kicinski , UNGLinuxDriver@microchip.com, "David S. Miller" Subject: Re: [PATCH net-next v2 1/1] net: dsa: microchip: ksz9477: implement MTU configuration Message-ID: <20220224093827.GC4594@pengutronix.de> References: <20220223084055.2719969-1-o.rempel@pengutronix.de> <20220223233833.mjknw5ko7hpxj3go@skbuf> <20220224045936.GB4594@pengutronix.de> <20220224093329.hssghouq7hmgxvwb@skbuf> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220224093329.hssghouq7hmgxvwb@skbuf> 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: 10:35:47 up 75 days, 18:21, 87 users, load average: 0.27, 0.23, 0.26 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=unavailable 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 Thu, Feb 24, 2022 at 11:33:29AM +0200, Vladimir Oltean wrote: > On Thu, Feb 24, 2022 at 05:59:36AM +0100, Oleksij Rempel wrote: > > > Are you sure the unit of measurement is ok? My KSZ9477 documentation > > > says this about register 0x0308: > > > > > > Maximum Frame Length (MTU) > > > Specifies the maximum transmission unit (MTU), which is the maximum > > > frame payload size. Frames which exceed this maximum are truncated. This > > > value can be set as high as 9000 (= 0x2328) if jumbo frame support is > > > required. > > > > > > "frame payload" to me means what MTU should mean. And ETH_HLEN + > > > VLAN_HLEN + ETH_FCS_LEN isn't part of that meaning. > > > > if I set this value to anything less then 1522, it breaks the NFS boot. Since > > my NFS server is configured with MTU 1500, i tried to guess how > > frame size is calculated on this chip. > > Sad that Microchip engineers can't decide on whether the MTU register > holds the "Maximum Frame Length" or the "maximum frame payload size". > They said both to have themselves covered, you understand what you will, > of course both are not right :) ¯\_(ツ)_/¯ > > > > + /* Now we can configure default MTU value */ > > > > + ret = regmap_update_bits(dev->regmap[1], REG_SW_MTU__2, REG_SW_MTU_MASK, > > > > + VLAN_ETH_FRAME_LEN + ETH_FCS_LEN); > > > > > > Why do you need this? Doesn't DSA call dsa_slave_create() -> > > > dsa_slave_change_mtu(ETH_DATA_LEN) on probe? > > > > This was my initial assumption as well, but cadence macb driver provides > > buggy max MTU == -18. I hardcoded bigger MTU for now[1], but was not able to > > find proper way to fix it. To avoid this kinds of regressions I decided > > to keep some sane default configuration. > > > > [1] - my workaround. > > commit 5f8385e9641a383478a65f96ccee8fd992201f68 > > Author: Oleksij Rempel > > Date: Mon Feb 14 14:41:06 2022 +0100 > > > > WIP: net: macb: fix max mtu size > > > > The gem_readl(bp, JML) will return 0, so we get max_mtu size of -18, > > this is breaking MTU configuration for DSA > > > > Signed-off-by: Oleksij Rempel > > > > diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c > > index a363da928e8b..454d811991bb 100644 > > --- a/drivers/net/ethernet/cadence/macb_main.c > > +++ b/drivers/net/ethernet/cadence/macb_main.c > > @@ -4727,7 +4727,7 @@ static int macb_probe(struct platform_device *pdev) > > /* MTU range: 68 - 1500 or 10240 */ > > dev->min_mtu = GEM_MTU_MIN_SIZE; > > if (bp->caps & MACB_CAPS_JUMBO) > > - dev->max_mtu = gem_readl(bp, JML) - ETH_HLEN - ETH_FCS_LEN; > > + dev->max_mtu = 10240 - ETH_HLEN - ETH_FCS_LEN; > > else > > dev->max_mtu = ETH_DATA_LEN; > > Yes, but the macb driver can be a DSA master for any switch, not just > for ksz9477. Better to fix this differently. Yes, it should be fixed. I just need some time to understand the proper way to do so. For now, let's proceed with the ksz patch. Should I send new version with some changes? 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 |