Article View: linux.kernel.netdev
Article #24249[PATCH net-next v23 02/15] net: phylink: keep and use MAC supported_interfaces in phylink struct
From: Christian Marangi
Date: Sun, 29 Nov 2026 23:05
Date: Sun, 29 Nov 2026 23:05
114 lines
14926 bytes
14926 bytes
Add in phylink struct a copy of supported_interfaces from phylink_config
and make use of that instead of relying on phylink_config value.
This in preparation for support of PCS handling internally to phylink
where a PCS can be removed or added after the phylink is created and we
need both a reference of the supported_interfaces value from
phylink_config and an internal value that can be updated with the new
PCS info.
Tested-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/net/phy/phylink.c | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index d736604b86f4..20759fe47eaa 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -63,6 +63,12 @@ struct phylink {
/* The link configuration settings */
struct phylink_link_state link_config;
+ /*
+ * What interface are supported by the current link.
+ * Can change on removal or addition of new PCS.
+ */
+ DECLARE_PHY_INTERFACE_MASK(supported_interfaces);
+
/* The current settings */
phy_interface_t cur_interface;
@@ -633,7 +639,7 @@ static int phylink_validate_mask(struct phylink *pl, struct phy_device *phy,
static int phylink_validate(struct phylink *pl, unsigned long *supported,
struct phylink_link_state *state)
{
- const unsigned long *interfaces = pl->config->supported_interfaces;
+ const unsigned long *interfaces = pl->supported_interfaces;
if (state->interface == PHY_INTERFACE_MODE_NA)
return phylink_validate_mask(pl, NULL, supported, state,
@@ -1808,7 +1814,7 @@ static int phylink_create_sfp_cage_port(struct phylink *pl)
port->is_mii = true;
port->active = true;
- phy_interface_and(port->interfaces, pl->config->supported_interfaces,
+ phy_interface_and(port->interfaces, pl->supported_interfaces,
phylink_sfp_interfaces);
phy_port_update_supported(port);
@@ -2111,6 +2117,9 @@ struct phylink *phylink_create(struct phylink_config *config,
__set_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state);
timer_setup(&pl->link_poll, phylink_fixed_poll, 0);
+ phy_interface_copy(pl->supported_interfaces,
+ pl->config->supported_interfaces);
+
linkmode_fill(pl->supported);
linkmode_copy(pl->link_config.advertising, pl->supported);
phylink_validate(pl, pl->supported, &pl->link_config);
@@ -2243,7 +2252,7 @@ static int phylink_validate_phy(struct phylink *pl, struct phy_device *phy,
* those which the host supports.
*/
phy_interface_and(interfaces, phy->possible_interfaces,
- pl->config->supported_interfaces);
+ pl->supported_interfaces);
if (phy_interface_empty(interfaces)) {
phylink_err(pl, "PHY has no common interfaces\n");
@@ -3062,12 +3071,12 @@ static phy_interface_t phylink_sfp_select_interface(struct phylink *pl,
return interface;
}
- if (!test_bit(interface, pl->config->supported_interfaces)) {
+ if (!test_bit(interface, pl->supported_interfaces)) {
phylink_err(pl,
"selection of interface failed, SFP selected %s (%u) but MAC supports %*pbl\n",
phy_modes(interface), interface,
(int)PHY_INTERFACE_MODE_MAX,
- pl->config->supported_interfaces);
+ pl->supported_interfaces);
return PHY_INTERFACE_MODE_NA;
}
@@ -3946,14 +3955,14 @@ static int phylink_sfp_config_optical(struct phylink *pl)
phylink_dbg(pl, "optical SFP: interfaces=[mac=%*pbl, sfp=%*pbl]\n",
(int)PHY_INTERFACE_MODE_MAX,
- pl->config->supported_interfaces,
+ pl->supported_interfaces,
(int)PHY_INTERFACE_MODE_MAX,
pl->sfp_interfaces);
/* Find the union of the supported interfaces by the PCS/MAC and
* the SFP module.
*/
- phy_interface_and(pl->sfp_interfaces, pl->config->supported_interfaces,
+ phy_interface_and(pl->sfp_interfaces, pl->supported_interfaces,
pl->sfp_interfaces);
if (phy_interface_empty(pl->sfp_interfaces)) {
phylink_err(pl, "unsupported SFP module: no common interface modes\n");
@@ -4191,7 +4200,7 @@ static int phylink_sfp_connect_phy(void *upstream, struct phy_device *phy)
/* Set the PHY's host supported interfaces */
phy_interface_and(phy->host_interfaces, phylink_sfp_interfaces,
- pl->config->supported_interfaces);
+ pl->supported_interfaces);
phy_set_upstream_port(phy, pl->sfp_cage_port);
--
2.55.0
Technical Details
Message-ID:
<20261129230558.612526-3-ansuelsmth@gmail.com>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373692-linux-kernel-netdev=dewy.ruReferences:
<20261129230558.612526-1-ansuelsmth@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373692-linux-kernel-netdev=dewy.ru From: ansuelsmth@gmail.com (Christian Marangi) Newsgroups: linux.kernel.netdev Subject: [PATCH net-next v23 02/15] net: phylink: keep and use MAC supported_interfaces in phylink struct Date: Mon, 30 Nov 2026 00:05:32 +0100 Organization: Usenet Network Message-ID: <20261129230558.612526-3-ansuelsmth@gmail.com> References: <20261129230558.612526-1-ansuelsmth@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1280839"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:cpJEcWnMEb2NjHqfORoTPZA9AiQ= sha256:siiSLojSRocq3Q9CSkyZdKeBJSGQdSJz1ih8g45ysC4= sha1:YHkPNLfxKnGZk0kgjcsKD/qrkwo= sha256:aMYGkfw2PuguSKxm5lj7V+QnYuG3qTELnN7CsKNgcS4= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 7B295125F08; Mon, 30 Nov 2026 02:06:52 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.149 X-Spam-Status: No, score=-3.149 tagged_above=-9999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3ELRC61tR50I; Mon, 30 Nov 2026 02:06:48 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-373692-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 08B76125FB2; Mon, 30 Nov 2026 02:06:35 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 373D124418; Sun, 29 Nov 2026 23:06:29 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795993586; b=WckE07S9x9CTj/6hbwRWIeqHfHEEX46o6pJTOPrlpAkRLn1sdIvw0ffOXhdjtAhMz44H RyQEK2CRfbipTz+YYC62MuJgDXGsVp1TgYoN2+tjDi9Df1Prn7LbvlW+Z66y93nHg9Bc6 6Tl8wxL+ZdylVa16xT9vEYf/lAmDfV4FQPIUtQMhd9AoxodSLXCiGd6tq3zKQMxlSbS9A 3M1EHXinDeG6BvGQpSa2g4e4aB+JMdji88AE2r7kG8MZvMC4ckSXmNgLoY8jnMNhmYrma nv2zRSIF4WjpC05Zub1f4m74ePGRjwPQwO3YxRMjgOHOV7Axt1VOao9HTXpmFaOFz6w== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795993586; h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature: X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State: X-Gm-Gg:X-Received:Received:From:To:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:X-Mailing-List:List-Id:List-Post:List-Help: List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version: Content-Transfer-Encoding; bh=WkkPuq5tNr+TLMvQhiW+fzQBO0e76WILHXlkwAiGW7s=; b=Sy/NAqClqzL5A+XrrokboMcpfv9sXJtkDcqhUz99vanV4xH6Ct6hLwUlG0Dpanv3OSOn 6Aj9vzeDaaLWsNR8GqZFvtFmkbtbGYwSAnBYLpE/4J0RFm58ZjBEegpDhM0RRWs+rjEn6 r0xhh+I4q9uCGbbdEZ8axY91u2/TVQaxubjri4Yw336pS1YKMeMgEDtqH54Bs2ghR/MOg tF6dqBMcRfbrrLpfrROSdPpBSAWeusRdMxuPP44gUsmRNnZ33PnkXl7GENV0OKH9P93Wf WC+HOvvUAXvHAC76iqUWAWFVjxLvCm81JlbozydXEqrnXiMtEsiawPLz1ubzWhZ4ZAA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=ImwFxREU; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0F6E6606A68C; Sun, 29 Nov 2026 23:06:26 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=ImwFxREU X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.50 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795993585; b=qVv5DJVlYZYJ+ampZJC7AtEQAFhihQZvT4UpeJsURK3tjLZIPADDAuhf3ojQHtABsQel Ema8ju8H7dJLH9I9HSFWOCOcj2IeUVGyW1B29DlSAcZ+7GQQr+QnWyxJ2+NoNf9p5HU9S 8nMpkIYx6TO1+4i3gae7SFtuEKZlhlzBQeKXcV6DpYiRpJDTIGbz3ohUGngFy+faCgiJe IKkD6k/p8PhrQuYd0PAUEzXAkhT6GDK4Yz51Fc0uRKcHLHd0gMVQoH89nOVsMNZZ/gSKK Su2Pj7phGz+sgLyLk820EEUazDBXKJYC1aYk+kXt7+E+VzPp4oc/sKBcSOG3LYQrADw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795993585; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=WkkPuq5tNr+TLMvQhiW+fzQBO0e76WILHXlkwAiGW7s=; b=vtaWtHB7cYYn/bVlQ6C3PDZA3VW4WZOULDhAYmETCa9wEGFlbwSXGtTr+YUQfu0Nd4Py iE99o1n+RRJPkuG9lYlp9cf8NaidCrhVKDI9cKfAzWhCKNPSRy2bOfZwBhTy8iqI2CTML YVMaItm5C3FEDLhKC7xGbrQ0yr/XWAqooudK7F7+FQMjEMxPZGI1yHmse99KIeGgNA4yU yygE7DR9DCapc+Y7EP1UtiO/LCvTCYCM+jDbcLrumvibh+UO549Qjr6wrdTPLIHdwvAGh rjBLytzRBvypGNG+QKN4aoAQC1FrKixOdqXfM2UbLMjNrtrwo16DAprwnW3F6LkBivg== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=ImwFxREU; arc=none smtp.remote-ip=209.85.221.50 X-Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E1771606A6A2 for <netdev@vger.kernel.org>; Sun, 29 Nov 2026 23:06:24 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E1771606A6A2 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com X-Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-492f0a1b685so7096774f8f.0 for <netdev@vger.kernel.org>; Sun, 29 Nov 2026 15:06:24 -0800 (PST) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1795993583; x=1796598383; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=WkkPuq5tNr+TLMvQhiW+fzQBO0e76WILHXlkwAiGW7s=; b=ImwFxREUTCUjnio6QHq/Mk+vXom2O5pi7W3V92qXr4p+Cs15kUb88DLOk4xO4GBcKB tt6iEtfbw0vtyIBVUmhBl4HBKBV+k1zSnu4PPWcYPtaFWPeqQBn5rspvB9fTGHt01h9h mCS3ifCJR4LRrFqwsk9P18c7maR4n00SAnRBRiMZl9gDrv6coFI38o4VvYhR7o7uT/+Q SpqSxKkkRkn/yrVy+MZXku9Ak+Mv10wnA1b7ZrHLrctC2WM0UnBz9T9W32lLHjpz7fj1 1hNLh/SLr1JnhW3VNCGUJlk408DSdEof8Nhvh0qWz4ZVZo2aUxlu9/6PToY54VrM3mE2 944g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795993583; x=1796598383; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=WkkPuq5tNr+TLMvQhiW+fzQBO0e76WILHXlkwAiGW7s=; b=C1PDC5FKDEb2VKLmVMaZSWwwQrg7zD94AFdjGktrUJGjH9nNYhZ3ZW4aN/ZBiYFQia o2NIqSkvXR0B6M1PmADOvio61CRpvxPIfw2ClebaHcMp5v3Q1uHQSSoxFs7WGygTgY79 1vLmlGOB/xHNIAjNtewj7TMWVU8QjITwumzI8tRx2UP8VLwwtczVzDt3DLSd3w2j0S81 tdJJMC8lg85hIeATnb2wyx+juTF8DlaQIiKoEp1W3IpxZtD4quWuzxWRRTWTPBJz2Ay4 ecbWj4VhabZlTD+JptTwrheWQSAVe5jFK8iiToXPhZnHqtrTnGhib9/dhGQIaatCkfcp f1IQ== X-Forwarded-Encrypted: i=1; AL+hErE47j8JcVlntkmWnFsQIHhGk4t3WiN5wqtbHBHRMs5WkqNpiR4bW/Jffp2Ht3X97E1/66K7KsE=@vger.kernel.org X-Gm-Message-State: APuU4Z90vtooaodLUtUj3Q08ZMRSssWAEwTOQRWRWdoBZ19I+f5kMOdI Ta5LHHdok2BY4P8ezuMhQjclkUUSG0FDKkteB4yiYKPQFtPl+B1XaKxF X-Gm-Gg: AZFdTZehLiOSxqlmH3awPmQ/rw6Eo8L6m5JcA+64LaNbgFur1RJaKW6rmWhS+A4L/Ob FKU6HhrCKUJGl4xp4NPJRN9SFC5IPA5/YBQ0gDJvNaieciZ7pLfjAiOSUKzcO5MCebPgxPFwhXB YwGv8Z10/O/jfZ9v4eo8Ju0cKfZtpUc0PMtarFwsbegYzMsyf9QOEwsgMHwAUcoR1xQ6K4AX/MI 70Qz0TeXxRkT+5vrc8IAEqyFX9kQdXanCNu427lLNKEHS01N3buNDAxVdf04zhvRL04Mev7RZP4 9AHI6UXJkRvuI0uYgShClCwcXO8pzhmquAMzAYvDnBPTNB3ccqYOKNwJy3pN8n1jja9e2xdx9E8 Zh4T9Caf11pVuEkvx6S0+tM5zQ64TooUHBhSNEnil8V68byrPMGSXZU5L5YmCqCYoBTM1PLHjZG AECI88udyF0L7XrxkBfHlLRTbfKkHppphmMvq0T7nyWqsIc5LDckrI4AQC4NbZJeGU88e6XM28Y kTYGH8eaj/bgBifair4uwBPczLCJmIdW1FLAJHj7FNr+MskFI47Yy01WuQ+tMagtKb3R2rMexI+ dlGRIVN60lL3C5QntPtBbYo3gZkIlGnvHqjandQsGxJkO13bV9C6CgvDmXHrdklyhuZJradsGEN Ze0N2KSXg6zDiEcypEQ== X-Received: by 2002:a05:6000:290b:b0:4b7:8363:682 with SMTP id ffacd0b85a97d-4b7836306d3mr38286419f8f.16.1795993583234; Sun, 29 Nov 2026 15:06:23 -0800 (PST) X-Received: from Ansuel-XPS24 (93-34-92-103.ip49.fastwebnet.it. [93.34.92.103]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-4ab6c4353d6sm58448894f8f.56.2026.11.29.15.06.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Nov 2026 15:06:22 -0800 (PST) X-Mailer: git-send-email 2.55.0 X-In-Reply-To: <20261129230558.612526-1-ansuelsmth@gmail.com> X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list