From nobody Sun Feb 8 22:58:23 2026 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 751932989A2 for ; Wed, 28 Jan 2026 20:45: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=1769633146; cv=none; b=M3wN16AWBDW0305eYgDIUR/zQCWQlY5sSBTrqPbLOjjB0uNGEVuRRPzZVaH9TDoQSZbqQA3nQadgOvil4jeJHFDckGVk3nGvn88wYvuVgcnOB/+xh/qMaCa78BMwfibOdONIQ9OduGb22HC8IwsQg6SUxGflUlHcMNy+Gx/NGMk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769633146; c=relaxed/simple; bh=cVlGaDtD/sHzN/VmwT1BIJq3CDK2ab5YwpOqp1MmRXU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tq9Qk+neKpFyCf1myrAHGEJX0LpA119F9h8u38aAwvbZ0Cm+cSIeJnSjJRyRsPSBlvGVT6jiv2Psj+2Kf1I3005CBj3y16FyjWZojyFe8nRKsJLcoNNM6uweKEJVXPRgSJdJWQHkOcJHxUhOYNJgDpy/cpNlI/wfkLiuy9ASflg= 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=EiVu0vk0; 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="EiVu0vk0" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 32780C211F1; Wed, 28 Jan 2026 20:45:45 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 8421D6071F; Wed, 28 Jan 2026 20:45:42 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 6BFFD119A882A; Wed, 28 Jan 2026 21:45:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1769633141; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=cUxQMmS4PTgDBQUSEvvZqd3m1nQMmyjDBJyQpg9/Dko=; b=EiVu0vk0MI5kVykZCoVFWr7dX3WM6oDjs/9NqFEXBph8d0lWjmjclq4Pwa3qIUVep20gsn utG1zgUCDSJeyWBdJW1HABfJWjK9yq2nOQREUiD6a5E1OEVdu1BQk/0waHzDtPOEmdT6+/ aLDKxVttJkljI/fbyCdFLUz3vI3PZsSaoS8vSIjEu8NziDVoz/6M60h+jkIjfnqbEkfTxS SUS62VJUXQGqCSI0fG7o3gwbH83tuTZKh0Sw/kxIfzlmvhJLelGBaisTT6l52VIRqpLjRt iLsqeh1IV+6yi2k3taMXxvAOUvR6zJD4W9KkcT6wBEBTb8yFp6Q5W2ontWjmJQ== From: Maxime Chevallier To: davem@davemloft.net, Andrew Lunn , Jakub Kicinski , Eric Dumazet , Paolo Abeni , Russell King , Heiner Kallweit Cc: Maxime Chevallier , 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=20Maincent?= , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Oleksij Rempel , =?UTF-8?q?Nicol=C3=B2=20Veronese?= , Simon Horman , mwojtas@chromium.org, Romain Gantois , Daniel Golle , Dimitri Fedrau Subject: [PATCH net-next v2 01/12] net: phy: phy_port: Correctly recompute the port's linkmodes Date: Wed, 28 Jan 2026 21:45:14 +0100 Message-ID: <20260128204526.170927-2-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20260128204526.170927-1-maxime.chevallier@bootlin.com> References: <20260128204526.170927-1-maxime.chevallier@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" 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 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/net/phy/phy_port.c b/drivers/net/phy/phy_port.c index ec93c8ca051e..68a0068220ed 100644 --- a/drivers/net/phy/phy_port.c +++ b/drivers/net/phy/phy_port.c @@ -118,11 +118,14 @@ void phy_port_update_supported(struct phy_port *port) int i; =20 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); + __ETHTOOL_DECLARE_LINK_MODE_MASK(med_supported) =3D {0}; + + phy_caps_medium_get_supported(med_supported, i, port->pairs); + linkmode_or(supported, supported, med_supported); } =20 + linkmode_and(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 */ --=20 2.49.0