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 3CCE7C77B6E for ; Wed, 12 Apr 2023 06:41:45 +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:MIME-Version:References:In-Reply-To: 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=ZVom/t3zaf30ENMFHTm48I0LgjxbjpmkBKEC2TG8Ujc=; b=aPoG4FioRnujCp zUT+cPevCGBtlRQqIsvIEltIztXzWkQ4icwc80KG9sfLwfP2nqdlHB55ZGfE7r0ew0xpHMOzeYgaj vJab2wsl5AiJMDRN82GFBB/FVTVQE9Y1qDTp1t3clgFS4RQckt6ZmrFeLu8V+gltvcOSW29WBB+L1 ZBCBpHcwC5vgElYWUEbPPgsxlQ90Gl3TQQAULs4ePHCfjJW+PydWWHob58XmPbtzMh2Pn4X1sj56r WBPFGFLCwCzyxiNpc9a5I96JbPzooikkBn1EnYDWI6upoCMSiQWsGEI7H59f+4fLLtUNuI0Gz0XJ1 Hw6vanqG2SOGtg431iYA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pmUA3-001zcf-06; Wed, 12 Apr 2023 06:40:55 +0000 Received: from relay9-d.mail.gandi.net ([2001:4b98:dc4:8::229]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pmU9z-001zaG-11 for linux-arm-kernel@lists.infradead.org; Wed, 12 Apr 2023 06:40:53 +0000 Received: (Authenticated sender: maxime.chevallier@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id ABF62FF806; Wed, 12 Apr 2023 06:40:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1681281643; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0inNdIAr829fr5K7PpU7etdJAAGCFNAmGQoieYPHcMs=; b=Kf6wrkZVYcGH40qojFViQ1U6OtDYwiD3KoDZyfc7LKCwqKFh0RSWyZFJWaN3XKFpAzd+od zMR4e2JrTgwnWyapS3bA6zmXOrZ++EB1+ZJAC8kbQ6a+UCXr0znrcB5ike8QnOTySXMAwi Eygdi0gAppNGzFzR+QxdUCrjcHjeGqqWgv3hkfkskEW/KSRN+5ex8E7tdPryUW7G2Zv0lA O+tDBtJJjeuzbOcaLPY0/nxanMaRYdF0qthFaLeyl9QQNuu41JoWIPGs6LdAkO10+kty6L RsVE1ZseC8SBwX++ZknMgAscxKqszVhUtclZo+5GFgXBSKNB9MELY13MGrpK4w== Date: Wed, 12 Apr 2023 10:38:12 +0200 From: Maxime Chevallier To: Michael Sit Wei Hong Cc: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Ong Boon Leong , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux@armlinux.org.uk, hkallweit1@gmail.com, andrew@lunn.ch, Looi Hong Aun , Voon Weifeng , Lai Peter Jun Ann , "alexis.lothore@bootlin.com" Subject: Re: [PATCH net v5 1/3] net: phylink: add phylink_expects_phy() method Message-ID: <20230412103812.45e52ab5@pc-288.home> In-Reply-To: <20230330091404.3293431-2-michael.wei.hong.sit@intel.com> References: <20230330091404.3293431-1-michael.wei.hong.sit@intel.com> <20230330091404.3293431-2-michael.wei.hong.sit@intel.com> Organization: Bootlin X-Mailer: Claws Mail 4.1.1 (GTK 3.24.37; x86_64-redhat-linux-gnu) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230411_234051_674865_4D4712A9 X-CRM114-Status: GOOD ( 20.98 ) 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 Hello everyone, On Thu, 30 Mar 2023 17:14:02 +0800 Michael Sit Wei Hong wrote: > Provide phylink_expects_phy() to allow MAC drivers to check if it > is expecting a PHY to attach to. Since fixed-linked setups do not > need to attach to a PHY. > > Provides a boolean value as to if the MAC should expect a PHY. > Returns true if a PHY is expected. I'm currently working on the TSE rework for dwmac_socfpga, and I noticed one regression since this patch, when using an SFP, see details below : > Reviewed-by: Russell King (Oracle) > Signed-off-by: Michael Sit Wei Hong > --- > drivers/net/phy/phylink.c | 19 +++++++++++++++++++ > include/linux/phylink.h | 1 + > 2 files changed, 20 insertions(+) > > diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c > index 1a2f074685fa..30c166b33468 100644 > --- a/drivers/net/phy/phylink.c > +++ b/drivers/net/phy/phylink.c > @@ -1586,6 +1586,25 @@ void phylink_destroy(struct phylink *pl) > } > EXPORT_SYMBOL_GPL(phylink_destroy); > > +/** > + * phylink_expects_phy() - Determine if phylink expects a phy to be > attached > + * @pl: a pointer to a &struct phylink returned from phylink_create() > + * > + * When using fixed-link mode, or in-band mode with 1000base-X or > 2500base-X, > + * no PHY is needed. > + * > + * Returns true if phylink will be expecting a PHY. > + */ > +bool phylink_expects_phy(struct phylink *pl) > +{ > + if (pl->cfg_link_an_mode == MLO_AN_FIXED || > + (pl->cfg_link_an_mode == MLO_AN_INBAND && > + phy_interface_mode_is_8023z(pl->link_config.interface))) >From the discussion, at one point Russell mentionned [1] : "If there's a sfp bus, then we don't expect a PHY from the MAC driver (as there can only be one PHY attached), and as phylink_expects_phy() is for the MAC driver to use, we should be returning false if pl->sfp_bus != NULL." This makes sense and indeed adding the relevant check solves the issue. Am I correct in assuming this was an unintentional omission from this patch, or was the pl->sfp_bus check dropped on purpose ? > + return false; > + return true; > +} > +EXPORT_SYMBOL_GPL(phylink_expects_phy); Thanks, Maxime [1] : https://lore.kernel.org/netdev/ZCQJWcdfmualIjvX@shell.armlinux.org.uk/ _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel