From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 00546C83F01 for ; Sat, 26 Aug 2023 14:52:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0cnLhVCTam+q6rEkPFGzLvtidcBcLYJ/MEVPH/p9fN4=; b=Fj1JyI5MRa4qlX 4TbjEmq2SeInz9OTSXKLevwhKV30HHUxKWVnExfIVsNhl522RWmaf/aWV1tP/VUYnyPXzf2aSzcCf N/ZFIy0Lxfx2gugXb36Q78GiMe+s9pf1jz9FqP94aTQkVdKF+VormgpI4zsupPY1gn1qHHwMX3j57 UCLq9Z2ZwPbBibupKkTimc9SDsnz6nFKimHZCMKSxihNsJfKrQFfGkYmdnqB2YiRcRuQ9UDrlnS11 yi4OWylu53Nx7LKInD2Ec3c2BW6v+A6NPvAvJr/5lq6Tu0JtM28agydRvTq7InXCOsp0N3FGmueL8 sEzWJzwsWNgZISAyQ1ig==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qZue9-006zlT-19; Sat, 26 Aug 2023 14:52:17 +0000 Received: from [2001:4d48:ad52:32c8:5054:ff:fe00:142] (helo=pandora.armlinux.org.uk) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qZue5-006zkU-1R for linux-arm-kernel@lists.infradead.org; Sat, 26 Aug 2023 14:52:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=2/XFiRWbsHAztbiWsUZlx5MlU2MgZke2abs/3p9CZK0=; b=QjG4Go9OCC7TxDShCUFGAF/zK2 GIzsaw2gEFaflqFM+3jnuXZ1K5IZ/jQ/C7vYg86wDWiWcpSouG2j2oDMn4dpjDRSQHKSgoDmrH6TL 8ehl9Xa+ZZJQt0HBC0ivqh2htMi/kqYCJrRF06ZTVxVM0qMIRoCMxvzsAfJ7myttlO0aUsA0Quuwa aQsg57cyGb2dZs4yVGmOHCkxNWTiqJNyabMxiAOhkBitDx3CZnhGkakXr+TQ9WbTxvLt+dRtZuXV6 eEO3n1a/2/cv+DlegEunqKdGGZ1WaL89ZxFN/lk4z8Rr3h1kLtXErLTUJZNK+Z3o4lddCELcYPzlE WpbtmYFg==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:58886) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1qZudp-0006HZ-0F; Sat, 26 Aug 2023 15:51:57 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1qZudl-0001Zm-B8; Sat, 26 Aug 2023 15:51:53 +0100 Date: Sat, 26 Aug 2023 15:51:53 +0100 From: "Russell King (Oracle)" To: Serge Semin Cc: Alexandre Torgue , Jose Abreu , Andrew Lunn , "David S. Miller" , Eric Dumazet , Feiyang Chen , Heiner Kallweit , Jakub Kicinski , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , netdev@vger.kernel.org, Paolo Abeni Subject: Re: [PATCH net-next 08/10] net: stmmac: move xgmac specific phylink caps to dwxgmac2 core Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230826_075213_482769_EC0D7765 X-CRM114-Status: GOOD ( 26.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Sat, Aug 26, 2023 at 04:32:15PM +0300, Serge Semin wrote: > On Thu, Aug 24, 2023 at 02:38:29PM +0100, Russell King (Oracle) wrote: > > Move the xgmac specific phylink capabilities to the dwxgmac2 support > > core. > > > > Signed-off-by: Russell King (Oracle) > > --- > > drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 10 ++++++++++ > > drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 10 ---------- > > 2 files changed, 10 insertions(+), 10 deletions(-) > > > > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c > > index 34e1b0c3f346..f352be269deb 100644 > > --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c > > +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c > > @@ -47,6 +47,14 @@ static void dwxgmac2_core_init(struct mac_device_info *hw, > > writel(XGMAC_INT_DEFAULT_EN, ioaddr + XGMAC_INT_EN); > > } > > > > +static void xgmac_phylink_get_caps(struct stmmac_priv *priv) > > +{ > > + priv->phylink_config.mac_capabilities |= MAC_2500FD | MAC_5000FD | > > + MAC_10000FD | MAC_25000FD | > > + MAC_40000FD | MAC_50000FD | > > + MAC_100000FD; > > +} > > + > > static void dwxgmac2_set_mac(void __iomem *ioaddr, bool enable) > > { > > u32 tx = readl(ioaddr + XGMAC_TX_CONFIG); > > @@ -1490,6 +1498,7 @@ static void dwxgmac3_fpe_configure(void __iomem *ioaddr, u32 num_txq, > > > > const struct stmmac_ops dwxgmac210_ops = { > > .core_init = dwxgmac2_core_init, > > > + .phylink_get_caps = xgmac_phylink_get_caps, > > This doesn't look correct. DW XGMAC doesn't support 25/40/50/100Gbps > speeds. So the reason this got added is to keep the code compatible with how things work today. When priv->plat->has_xgmac is true, the old code in stmmac_phy_setup() would enable speeds from 2.5G up to 100G, limiting them if priv->plat->max_speed is set non-zero. The table in hwif.c matches when: entry->gmac == priv->plat->has_gmac, entry->gmac4 == priv->plat->has_gmac4 and entry->xgmac == priv->plat->has_xgmac The entries in the table which patch on has_xgmac = true contain the following: .mac = &dwxgmac210_ops, .mac = &dwxlgmac2_ops, Therefore, to keep things compatible, I've effectively moved this initialisation into the new .phylink_get_caps method that is part of those two ops, and since they have has_xgmac true, this means that all these speeds need to be set. We do this without regard to max_speed, which we apply separately, after the .phylink_get_caps method has returned. So, the code is functionally identical to what happens in the driver, even if it is the case that xgmac210 doesn't actually support the speeds. If those extra speeds that the hardware doesn't support were present before, they're present after. If those extra speeds are limited by the max_speed, then they will be similarly limited. While it may look odd, since the specifications for Synopsys are all behind closed doors, all I can do is transform the code - I can't know that such-and-such a core doesn't actually support stuff. So my only option is to keep the code bug-compatible. I think all I've done here is make it glaringly obvious what the old code is doing and you've spotted "but that isn't right!" - which is actually a good thing! Feel free to submit patches to correct the functionality as bugs in the driver become more obvious! -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel