Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp1636877lqb; Sun, 26 May 2024 09:50:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVlBi2bya3Tp6jw77MreXlHHkw+hGjTB1GtU9ZFlQixLMLVNvwkrGVNSPNz+OcAQvQsLMNlGHksP2B0fgFQhEmQhKBATOHa57ZldpO4Yw== X-Google-Smtp-Source: AGHT+IEDNKxDysDNl1TYfZ94ao0EFQcbN32zOPT//2PX2aR66BtR05xf1N8hhuzHDJeIRuqaubSp X-Received: by 2002:ae9:c010:0:b0:792:c268:fbf0 with SMTP id af79cd13be357-794ab055030mr789080185a.6.1716742225948; Sun, 26 May 2024 09:50:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716742225; cv=pass; d=google.com; s=arc-20160816; b=Vjj4CWW4gLbwI5NYmJKC5tfR6NTs2lQfOwrKf00NC32hvXphq5MFedIRhIrrdl0fDY UMFTlWtn/aG9+OTdwj5HDCSTRW5HHRcPXQauPxpy3GzXTeWCymWcYmJ38R2MFcRDh7E4 4YoA7nWN0K8+60XsunTsuZaJ2d3Oo2OMgyUah1HNGHttGvws6mL0B4agJtKGA9hxcStq tf15HP0kUPnMJHMcwSSIOq3qDaVWjfupGPKocMz6gedC5esPobC8BIdQNhxn9hqgEAdM Try9/U3Jj0tHLHVcWxQ3PUFTBCF3dvdowC3i9O4pKgWBF5P8ydeqE2pcLEJJSSR/R38i UBjg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=Se3l6VfrArDiw2sv7ishS59ORjDk+6CLWOFsd5rBSlk=; fh=815TTRjkBuEw28VVDERt2WYGbRGGHojOfGvV4+BrxFY=; b=nJjlYkhRieI9bcGL/EigkFfJcOD35ukC/4QhwGQ2ACGOP7Xid7QlEkZdisijcHct4i 71KdTm/QpdLlLRVJ4KrvUwS8axsozPDsDbjg7JsuKQfYf5qxfrGxvYic+msSvsAWBjK2 gkITG7jTIZi62i8rHr673HrBdl1pvGV4C8g/F6M+9SH1oLoOmx2H64Q7cgXOEvaNwtZP h+KKffqtJJnSxIftJswXYrA7oOdFuUVhd97yolZdT0JqhrW5tzpqWH7yVo40AluvuKPh nCNVIKlkhn+zYthHr+r6XU3ob//wYDxYhPVk2i+pXrK/uNewDknpBUTY/xmComOuK6xv IF3A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=w2wVi6XE; arc=pass (i=1 dkim=pass dkdomain=armlinux.org.uk dmarc=pass fromdomain=armlinux.org.uk); spf=pass (google.com: domain of linux-kernel+bounces-189785-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189785-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-794abcac1b3si611100485a.101.2024.05.26.09.50.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 May 2024 09:50:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-189785-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=w2wVi6XE; arc=pass (i=1 dkim=pass dkdomain=armlinux.org.uk dmarc=pass fromdomain=armlinux.org.uk); spf=pass (google.com: domain of linux-kernel+bounces-189785-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189785-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 92BE71C2097B for ; Sun, 26 May 2024 16:50:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D90E4200D5; Sun, 26 May 2024 16:50:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="w2wVi6XE" Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6B931168B9; Sun, 26 May 2024 16:50:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716742214; cv=none; b=orHU5NAg/rI45/tFhaeuZsH2zqcakFCK2ytI5MRb50SJxzmf3vK/mDU5BPNaNSDA3K3XnK1jCJ+2/+fhyn4MjWtgnifb74AZT/TsahwBP6iS20Fj2soj6h+g//ixYZB1jKp9QynsQKwppMjRRduXkwJpDRkcof9vcFVHpsuUNpo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716742214; c=relaxed/simple; bh=ETjA3dGIbrqGmMPuDEM7g9G8PK00mOnqw3j6bdPx5Q0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=sGbcOHKqyzwjT4u16cWrndqwKPYvwx14Eftl3Gyr5rFTi836pUXYzDK12qBj9txExPngQKo6x3/gtaAtnNc3TqIGQ7dcbdAPuMis7OVA8P4g1XqHU6gpCvtrkRBDi4SyCmzyo1IwUZQ267zAEL9gNU+itLuPofJUbtAU5ZkpgfI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=w2wVi6XE; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk 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=Se3l6VfrArDiw2sv7ishS59ORjDk+6CLWOFsd5rBSlk=; b=w2wVi6XEWBHXj27s1jxicTfKm7 EyjyocygWLXY7RgaPeE84Eo0aLHKkIFEEk1p05hwhlc4WsoBTZ4bLyUjQku7N/VqqwpB6pdlJp65T Q0YqBcLapNOFqn7YaizyhRkoK63NxKl9Q4Du/3tVlDYYWr4il7fbD1FHeBnKNu8AmbVKmJTB6geF2 AOtHE/AejxFoXoRA6fQ8R8Drtjbob8M8UKUrR9PFJd45aWnv9S5DqRcumz1vGu/UZzzSJwEfyo/4S JC3lAFUb0byd7XTZnEsWoXXYyFziyZmWPkYy8Y7jm4GypTINxQNi9Px/0hkJ87R+JcRbab57XP2Jo EC9xRU8g==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:49196) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1sBH4A-0002pc-2v; Sun, 26 May 2024 17:49:52 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1sBH48-0001Wp-8T; Sun, 26 May 2024 17:49:48 +0100 Date: Sun, 26 May 2024 17:49:48 +0100 From: "Russell King (Oracle)" To: Serge Semin Cc: Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Byungho An , Giuseppe CAVALLARO , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , bpf@vger.kernel.org, netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH RFC net-next 2/3] net: stmmac: Activate Inband/PCS flag based on the selected iface Message-ID: References: <20240524210304.9164-1-fancer.lancer@gmail.com> <20240524210304.9164-2-fancer.lancer@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240524210304.9164-2-fancer.lancer@gmail.com> Sender: Russell King (Oracle) On Sat, May 25, 2024 at 12:02:58AM +0300, Serge Semin wrote: > The HWFEATURE.PCSSEL flag is set if the PCS block has been synthesized > into the DW GMAC controller. It's always done if the controller supports > at least one of the SGMII, TBI, RTBI PHY interfaces. If none of these > interfaces support was activated during the IP-core synthesize the PCS > block won't be activated either and the HWFEATURE.PCSSEL flag won't be > set. Based on that the RGMII in-band status detection procedure > implemented in the driver hasn't been working for the devices with the > RGMII interface support and with none of the SGMII, TBI, RTBI PHY > interfaces available in the device. > > Fix that just by dropping the dma_cap.pcs flag check from the conditional > statement responsible for the In-band/PCS functionality activation. If the > RGMII interface is supported by the device then the in-band link status > detection will be also supported automatically (it's always embedded into > the RGMII RTL code). If the SGMII interface is supported by the device > then the PCS block will be supported too (it's unconditionally synthesized > into the controller). The later is also correct for the TBI/RTBI PHY > interfaces. > > Note while at it drop the netdev_dbg() calls since at the moment of the > stmmac_check_pcs_mode() invocation the network device isn't registered. So > the debug prints will be for the unknown/NULL device. Thanks. As this is a fix, shouldn't it be submitted for the net tree as it seems to be fixing a bug in the driver as it stands today? Also, a build fix is required here: > - if (priv->dma_cap.pcs) { > - if ((interface == PHY_INTERFACE_MODE_RGMII) || > - (interface == PHY_INTERFACE_MODE_RGMII_ID) || > - (interface == PHY_INTERFACE_MODE_RGMII_RXID) || > - (interface == PHY_INTERFACE_MODE_RGMII_TXID)) { > - netdev_dbg(priv->dev, "PCS RGMII support enabled\n"); > - priv->hw->pcs = STMMAC_PCS_RGMII; > - } else if (interface == PHY_INTERFACE_MODE_SGMII) { > - netdev_dbg(priv->dev, "PCS SGMII support enabled\n"); > - priv->hw->pcs = STMMAC_PCS_SGMII; > - } > - } > + if (phy_interface_mode_is_rgmii(interface)) > + priv->hw.pcs = STMMAC_PCS_RGMII; > + else if (interface == PHY_INTERFACE_MODE_SGMII) > + priv->hw.pcs = STMMAC_PCS_SGMII; Both of these assignments should be priv->hw->pcs not priv->hw.pcs. I think there's also another bug that needs fixing along with this. See stmmac_ethtool_set_link_ksettings(). Note that this denies the ability to disable autoneg, which (a) doesn't make sense for RGMII with an attached PHY, and (b) this code should be passing the ethtool op to phylink for it to pass on to phylib so the PHY can be appropriately configured for the users desired autoneg and link mode settings. I also don't think it makes any sense for the STMMAC_PCS_SGMII case given that it means Cisco SGMII - which implies that there is also a PHY (since Cisco SGMII with inband is designed to be coupled with something that looks like a PHY to send the inband signalling necessary to configure e.g. the SGMII link symbol replication. In both of these cases, even if the user requests autoneg to be disabled, that _shouldn't_ affect internal network driver links. This ethtool op is about configuring the externally visible media side of the network driver, not the internal links. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!