From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (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 B443938E126 for ; Wed, 4 Feb 2026 07:39:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770190785; cv=none; b=Ewa7PL3ziqJkQhXq0VyZztvKUv1dyKAN2+U7hEy+s/tg1Zaa5r513oWcI5Dlqs05vMkbjLnLR0YQOJzVnhXe8I0v/j9vGo4dexqC2y7ZgULdhzHSV+6/RQu2aYjIdffRissUwU+bi0lWZc2fL/qzyaFFeAqjlB1lrUi+fCJHtsc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770190785; c=relaxed/simple; bh=/1pxWx644C8TLU/UaJGS1RYvZTIa3ThwwJW1g34kVq8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=YXPnlThq8OfnrTR9dmhV55O3HVCKLBeiymsutvBhc9YpAwk0JsvX/3X/DIzU+vujL1qF/Y1xjO+DqvsMTVRxJVFUU3BFrbMxQa4jErNMtgjtnV7VWCfDY2z+iqrAx3LjyfwdYZO857mqAih+FTjbtbpNSGtlbzkkGwNoF5Nsy64= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=ASFt7iAv; arc=none smtp.client-ip=185.171.202.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="ASFt7iAv" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id CE2E4C2439F; Wed, 4 Feb 2026 07:39:46 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 4540260745; Wed, 4 Feb 2026 07:39:41 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id A1E87119A865B; Wed, 4 Feb 2026 08:39:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1770190779; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:content-language:in-reply-to:references; bh=a1s1BXXCx27PuGqRuU7j6OliqPV6LuqtZN5Wh+JmuyY=; b=ASFt7iAvoEKBxUocM2AO600jqKvck4UhY8zGTKbvjSzRK0yyuCNeVZ3PZorwm7AXzlsV/A k5iEVUVSRRxMPEPUl6EwQZogTkvuzwro1D+2C6okuuqtwavmpa5tVDjccqV4fRG2o9FUD0 cS7adwFEB6gaMH0mUNBBccv3/mM1TmIFL25xL4Bj/polMeqbkE0OtDmISQfuYTsCkvRVBc lm0q7/pYc8aynp9QHWUojbMWBxCSeF/lNC8SkW9Aqyc7eg567v1+DPF2TkYi9ARFPIXZZ8 Eex6W9al2o2Ts83FG3y0vdDgLqrltdIw1mkb2JNZz0sEROV7aTdtVXfg0f6HaA== Message-ID: <8d6a8d0a-77e1-47cd-8562-ae852e22a62a@bootlin.com> Date: Wed, 4 Feb 2026 08:39:28 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next v4 03/13] net: phy: phy_port: Correctly recompute the port's linkmodes To: davem@davemloft.net, Andrew Lunn , Jakub Kicinski , Eric Dumazet , Paolo Abeni , Russell King , Heiner Kallweit Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, Christophe Leroy , Herve Codina , Florian Fainelli , Vladimir Oltean , =?UTF-8?Q?K=C3=B6ry_Maincent?= , =?UTF-8?Q?Marek_Beh=C3=BAn?= , Oleksij Rempel , =?UTF-8?Q?Nicol=C3=B2_Veronese?= , Simon Horman , mwojtas@chromium.org, Romain Gantois , Daniel Golle , Dimitri Fedrau References: <20260203172839.548524-1-maxime.chevallier@bootlin.com> <20260203172839.548524-4-maxime.chevallier@bootlin.com> From: Maxime Chevallier Content-Language: en-US In-Reply-To: <20260203172839.548524-4-maxime.chevallier@bootlin.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Last-TLS-Session-Version: TLSv1.3 On 03/02/2026 18:28, Maxime Chevallier wrote: > a PHY-driven phy_port contains a 'supported' field containing the > linkmodes available on this port. This is populated based on : > - The PHY's reported features > - The DT representation of the connector > - The PHY's attach_mdi() callback > > As these different attrbution methods work in conjunction, the helper > phy_port_update_supported() recomputes the final 'supported' value based > on the populated mediums, linkmodes and pairs. > > However this recompute wasn't correctly implemented, and added more > modes than necessary by or'ing the medium-specific modes to the existing > support. Let's fix this and properly filter the modes. > > Fixes: 589e934d2735 ("net: phy: Introduce PHY ports representation") > Signed-off-by: Maxime Chevallier > --- > drivers/net/phy/phy_port.c | 25 ++++++++++++++++++------- > 1 file changed, 18 insertions(+), 7 deletions(-) > > diff --git a/drivers/net/phy/phy_port.c b/drivers/net/phy/phy_port.c > index a269e9ea12c4..ad2580529842 100644 > --- a/drivers/net/phy/phy_port.c > +++ b/drivers/net/phy/phy_port.c > @@ -108,16 +108,10 @@ EXPORT_SYMBOL_GPL(phy_of_parse_port); > */ > void phy_port_update_supported(struct phy_port *port) > { > - __ETHTOOL_DECLARE_LINK_MODE_MASK(supported) = { 0 }; > + __ETHTOOL_DECLARE_LINK_MODE_MASK(supported) = {0}; > unsigned long mode; > int i; > > - for_each_set_bit(i, &port->mediums, __ETHTOOL_LINK_MEDIUM_LAST) { > - linkmode_zero(supported); > - phy_caps_medium_get_supported(supported, i, port->pairs); > - linkmode_or(port->supported, port->supported, supported); > - } > - > /* If there's no pairs specified, we grab the default number of > * pairs as the max of the default pairs for each linkmode > */ > @@ -127,6 +121,23 @@ void phy_port_update_supported(struct phy_port *port) > port->pairs = max_t(int, port->pairs, > ethtool_linkmode_n_pairs(mode)); > > + for_each_set_bit(i, &port->mediums, __ETHTOOL_LINK_MEDIUM_LAST) { > + pr_info("Adding mode for medium %d pairs %d\n", i, port->pairs); Bah. That print statement doesn't belong here... Maxime