From mboxrd@z Thu Jan 1 00:00:00 1970 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 182B51BCA0E for ; Thu, 10 Oct 2024 13:00:40 +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=1728565243; cv=none; b=p8T2vwTUEv0bS1e+M9RwMzsNxq9v8ciixseGVvZlYd5J0aO+SJgDtWFeZx6SPb2Xkh7IC1v9x28yNUC+E7IPT7qx+tLccDXrApOHsrldxK7iJU959+RNcZ3eCvYNlDUSf5ORYKviUO2l/E8OwD7oQVijGL8wJYr3eU+Jg/kx1jo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728565243; c=relaxed/simple; bh=p7svB2h4EXYKSowqH5VimIFBZmcTxc0muViOkAFHuyQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=fdaLQRibr5fPo8AmYfFGmmJrzbK4F5ivRIsH7/svggjcSP8O1LE7HL0zLtmSR27UbmK8bfXE5dHSfk99X/7k8gkrKGu+HGjgBeXTOKV4NxPImJJZyBn02riPtsPIzwn74X/p0X9pQBuR6WAlQUr+7Aky3mkbzivZezgaRYaM8+w= 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=tCc9xP2I; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="tCc9xP2I" 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=BgT4mMqzShj8qDMwc0FMAvL3BmOW4M63NstBPGV2AFA=; b=tCc9xP2ICLJnl/Dc5wPMDLegLr snIk1IS7BmxKFZSrhJ3QdmRbFmBX7oz/mrbuXwCcMzz7achgPJqCPSm+2fMlkOfmrqCU2Qv+xU5Dm txY5jIgsmPcBBQX6Bu9oK59JIV2JvHImKZ+2w9diawpzfHgbOpn9EJShFK1CQVMVS37p7uSh9UQNO Dbu1801Mg7UyTPvIu4Qsas24BWqBKFAbW+QxFLdrtH7hYcf2gZwDtdMcI7czraLNEM7OM7KHd5PZ3 lOE7SEXFF/ibiDo5/lA+72f8EZfJy5IPnQFYiH5GIWMStQfQaFF7NeYyo8HEAtRrC7DdFuj0Imk3k yaicV27A==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:41046) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1sysmR-0002Ps-1E; Thu, 10 Oct 2024 14:00:34 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.96) (envelope-from ) id 1sysmO-0007Jz-19; Thu, 10 Oct 2024 14:00:32 +0100 Date: Thu, 10 Oct 2024 14:00:32 +0100 From: "Russell King (Oracle)" To: Vladimir Oltean Cc: Andrew Lunn , Heiner Kallweit , "David S. Miller" , Eric Dumazet , Florian Fainelli , Jakub Kicinski , netdev@vger.kernel.org, Paolo Abeni Subject: Re: [PATCH net-next 3/3] net: phylink: remove "using_mac_select_pcs" Message-ID: References: <20241009122938.qmrq6csapdghwry3@skbuf> Precedence: bulk X-Mailing-List: netdev@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: Sender: Russell King (Oracle) On Thu, Oct 10, 2024 at 12:21:43PM +0100, Russell King (Oracle) wrote: > On Wed, Oct 09, 2024 at 03:29:38PM +0300, Vladimir Oltean wrote: > > On Tue, Oct 08, 2024 at 03:41:44PM +0100, Russell King (Oracle) wrote: > > > With DSA's implementation of the mac_select_pcs() method removed, we > > > can now remove the detection of mac_select_pcs() implementation. > > > > > > Signed-off-by: Russell King (Oracle) > > > --- > > > drivers/net/phy/phylink.c | 14 +++----------- > > > 1 file changed, 3 insertions(+), 11 deletions(-) > > > > > > diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c > > > index 4309317de3d1..8f86599d3d78 100644 > > > --- a/drivers/net/phy/phylink.c > > > +++ b/drivers/net/phy/phylink.c > > > @@ -79,7 +79,6 @@ struct phylink { > > > unsigned int pcs_state; > > > > > > bool mac_link_dropped; > > > - bool using_mac_select_pcs; > > > > > > struct sfp_bus *sfp_bus; > > > bool sfp_may_have_phy; > > > @@ -661,12 +660,12 @@ static int phylink_validate_mac_and_pcs(struct phylink *pl, > > > int ret; > > > > > > /* Get the PCS for this interface mode */ > > > - if (pl->using_mac_select_pcs) { > > > + if (pl->mac_ops->mac_select_pcs) { > > > pcs = pl->mac_ops->mac_select_pcs(pl->config, state->interface); > > > if (IS_ERR(pcs)) > > > return PTR_ERR(pcs); > > > } else { > > > - pcs = pl->pcs; > > > + pcs = NULL; > > > > The assignment from the "else" branch could have been folded into the > > variable initialization. > > > > Also, maybe a word in the commit message would be good about why the > > "pcs = pl->pcs" line became "pcs = NULL". I get the impression that > > these are 2 logical changes in one patch. This second aspect I'm > > highlighting seems to be cleaning up the last remnants of phylink_set_pcs(). > > Since all phylink users have been converted to mac_select_pcs(), there's > > no other possible value for "pl->pcs" than NULL if "using_mac_select_pcs" > > is true. > > Hmm. Looking at this again, we're getting into quite a mess because of > one of your previous review comments from a number of years back. > > You stated that you didn't see the need to support a transition from > having-a-PCS to having-no-PCS. I don't have a link to that discussion. > However, it is why we've ended up with phylink_major_config() having > the extra complexity here, effectively preventing mac_select_pcs() > from being able to remove a PCS that was previously added: > > pcs_changed = pcs && pl->pcs != pcs; > > because if mac_select_pcs() returns NULL, it was decided that any > in-use PCS would not be removed. It seems (at least to me) to be a > silly decision now. > > However, if mac_select_pcs() in phylink_major_config() returns NULL, > we don't do any validation of the PCS. > > So this, today, before these patches, is already an inconsistent mess. > > To fix this, I think: > > struct phylink_pcs *pcs = NULL; > ... > if (pl->mac_ops->mac_select_pcs) { > pcs = pl->mac_ops->mac_select_pcs(pl->config, state->interface); > if (IS_ERR(pcs)) > return PTR_ERR(pcs); > } > > if (!pcs) > pcs = pl->pcs; > > is needed to give consistent behaviour. > > Alternatively, we could allow mac_select_pcs() to return NULL, which > would then allow the PCS to be removed. > > Let me know if you've changed your mind on what behaviour we should > have, because this affects what I do to sort this out. Here's a link to the original discussion from November 2021: https://lore.kernel.org/all/E1mpSba-00BXp6-9e@rmk-PC.armlinux.org.uk/ Google uselessly refused to find it, so I searched my own mailboxes to find the message ID. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!