Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp529742rwl; Tue, 11 Apr 2023 23:47:15 -0700 (PDT) X-Google-Smtp-Source: AKy350a8YxERK5AGX9WiaKKBqWjZ1bLhozGFbqXO5nYSH8ZLHGl377ILE381bmFiKGh6u1uKCsEy X-Received: by 2002:aa7:cd69:0:b0:504:a317:b9de with SMTP id ca9-20020aa7cd69000000b00504a317b9demr4756874edb.28.1681282035253; Tue, 11 Apr 2023 23:47:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681282035; cv=none; d=google.com; s=arc-20160816; b=q9EHu501dQRIr31Ii/ivQlMSn1GM+EXjtJEfSM6ThOaRGtxa7GWjZ35+nWwiJPU27V 4kqS1xsTZX9HMyHk1F1dK0iXv7mgdH4emLOqJtMNrjbKS+r//ixtHkSv8GPRdh9Q8ocY zSYVwhKtpQGro7da9+LDrqM1aha9qoARkI1mf38CDwj2F3MGA49X8YQ170F2tSbo52o6 lIRUwj7Dp4PMqSYYTCsPaV3wCcHhngTAIftYw8ibZoxmV6KGS7pwTwJLNLxPV3aLVqs7 uPfQoC6KgcCdaZah5R6aH5KLCyxnY0HJW+fGyl26ZeAi/ZN7BeonOmRaIRuRY89lIqR8 kXLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=0inNdIAr829fr5K7PpU7etdJAAGCFNAmGQoieYPHcMs=; b=EZHWZuip9GqlLKRkzStSX0SiyVnVSrLd4P3Jhye/BPboIaHjebV0N+xO3kCpmmerZU e+9jU8cTnlE5goaomc72AR8aEfRWbw3r0XWcKBWYQHcGsR8sqUj3//OJCfSMs4Z+ACo8 nSMgoGYGYWRCvfXZmXrUYmeAL4TWtuk9OPO+U8DHNwwU+wYerIUULJOEKnCcB03JgWfU 6KLob+m8ilf++FyLO8IEMnhyPTmNVjHCpgXJnpIWlKa2YxfdZXuZ3wNXuTsMvfsOksx/ igCCfCA0Hrlj6pqgkXX/P/jCn+vwS1SMEzx0rUKjQdvh+PLAuMR3IoW5UXQPogKz6KlV UL+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=Kf6wrkZV; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ud24-20020a170907c61800b0094a44eda460si8443271ejc.87.2023.04.11.23.46.49; Tue, 11 Apr 2023 23:47:15 -0700 (PDT) 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; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=Kf6wrkZV; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229746AbjDLGkt (ORCPT + 99 others); Wed, 12 Apr 2023 02:40:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229535AbjDLGks (ORCPT ); Wed, 12 Apr 2023 02:40:48 -0400 Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2537C10B; Tue, 11 Apr 2023 23:40:44 -0700 (PDT) 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 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 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. >=20 > 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(+) >=20 > 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); > =20 > +/** > + * 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 =3D=3D MLO_AN_FIXED || > + (pl->cfg_link_an_mode =3D=3D MLO_AN_INBAND && > + phy_interface_mode_is_8023z(pl->link_config.interface))) =46rom 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 !=3D 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/