From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 01560606A329 for ; Sun, 29 Nov 2026 23:07:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=3u1fARpy; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=a5Vf2SpD DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:To:From:Reply-To: Cc:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=WkkPuq5tNr+TLMvQhiW+fzQBO0e76WILHXlkwAiGW7s=; b=3u1fARpyH7HjY4 gOQKSbCCsLzrujc5E4XQWKafRNcVwZbD/dpU7+zDHkb2M7Ow/jyvxtsWgPlQKzZ1eLG0gmlWrt9Ic OTx2fmk3Q/nPWhTSx3VQCs881rNd6w/jkKrU3FifJ/qjC5/nxWU3O19UgoBpjCXWoDla4bxdAsHUg W3JsAHaMmxNf37TeaT1zhnAdNpk2tgj97SpJuRTAgxQ6v5k+78NkVE7msYp0Yo5vO0Fw2GDcTd2KX AGIyh91xnXH7j3WZYQiETR0dY8Sop4IfL46T+6NtA/olRReZ8PqPB/bPamXq5W4Eo9nQjRhEsFtPr R2yehXhdzpb9whzN1z3Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xXnyk-00000002ZYp-0FUO; Sun, 29 Nov 2026 23:06:42 +0000 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xXnyS-00000002ZMu-3nef for linux-arm-kernel@lists.infradead.org; Sun, 29 Nov 2026 23:06:26 +0000 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-49465892f7bso7230740f8f.1 for ; Sun, 29 Nov 2026 15:06:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1795993583; x=1796598383; darn=lists.infradead.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=a5Vf2SpDLY6ldKUNxLSYkY9vIZpgedADERpnjVfAMT+c4S1WYr1iTHoeknDMZ1M6JA qw5H+uIP+t8pfRGNozFL0FMBKdmf4VB8R+CXCUz/+yqFkGuuW76nLzqNJiG+Jw0vwiGh 9bIx1sPzNyDJPkN9HUR5VGuZN1X4Vmil55KrWk5Iq1/KziXbwjrUTFGYAM9A9c6dYYZz rmyi82HYavanX0Rdo5rtdlGcC8Ljp3dSe5K/OPXGVNXpCpJNWoMJ9ngqaVYYPJPYqjDr xLIfoHvYpMeGyXSX5fytSNmvOEvUf1hlBYXeCymES2yZ3BZmgGIV9xslCWk3u1E5OPum 71Zw== 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+fzQBO0e76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2xbH8awMH3Rs0tw6feAziMjbN8cZTSafvLWabh/qAZMLnUerHYVKPSC/mzcp4NS ct1qqmfAqdT1TBiIDxmmojglHUGvzEFr1bJi2HpaMSDkUfYQbo7zx5olu3PzjPKi7MmmFhJ/jQS RgNKIN6csP0uFiQX7fJ6iZyDz2mBQx3J3RhzxegwceW3i9+wmylCMEQch5h5+vraAt+xqWGXtLF Pu4XVE5MrZvnZO6pBdQ== 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) 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) From: Christian Marangi To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Willem de Bruijn , Simon Horman , Jonathan Corbet , Shuah Khan , Randy Dunlap , Christian Marangi , Lorenzo Bianconi , Heiner Kallweit , Russell King , Maxime Chevallier , Philipp Zabel , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , "Russell King (Oracle)" , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, llvm@lists.linux.dev 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 Message-ID: <20261129230558.612526-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261129230558.612526-1-ansuelsmth@gmail.com> References: <20261129230558.612526-1-ansuelsmth@gmail.com> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261129_150625_225368_DCED036D X-CRM114-Status: GOOD ( 18.86 ) X-Spam-Score: -2.1 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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 Reviewed-by: Maxime Chevallier Signed-off-by: Christian Marangi --- 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