From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796389022; b=TdKiYfN9biDnJHkPINJTWwrl2QNuHyhF1jUh/LrouuzjmhpAQsPV/BIcQyfCKPHHd2IK W8LRic2Qx0cvqdAJFFqQ/Q6PKWL1HNL0sT9RqWZX2ONBUaNu7OFC5PPtyrsJz9OAiiBjk O4f4+GlSB5TlJZixomfxT9ydOzZ45lTWDuH2Xa94/Xz3jxvC4LC6TTsOESuq9UiQ0lQDq M0eglkvEDdN8AfvaGxwIDUnsrUXy23pRoIHGHAt0qa/sMYcMHGT7BKMQq9JE05Wr2BXdj Qi817glB1fuxSxLuAV86upYnk+qEx/GplgRqJggdzo3i+p/B/qFPWRuxfITwwxFpsVA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796389022; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=qTSkMMn5tUgnjdXt6JT1TL7J3C+yemRlPi+u1A2k/fw=; b=Pvu5+YtUg83gl+/Kz2IZ1ITrds0ybLrLf61HhWea/52H8gdbxXlmvdOpVvIDLoXqR62q Q0U3q1oMhePyhEiELNmcFzaxs5KfMuXGncLj/9S8wVRN2CcNkIQ6H4Zhuw5T55VDIuzoG dVpIqXvX/eFa13NwCPuZnWLQLGgSdGTnqvPEo4g7HGuTZgjaw4F3QQstYZ0qKNYwSmctm AbUP0wcWJyCO9TooxRNNzCJaOrOmNDLQc774FS1Wz/SJ9YRr1lHVFeiRLWcWw3XcPWfka AHbMP0lQw38MSpQtDXmLAFxmgfSzNFx5HuSwPMVUU4FPDJ1aSMF/IUIJstnyh4CQG2A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=ES0lzA7d; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0B607606A322; Fri, 4 Dec 2026 12:57:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=ES0lzA7d Received: by smtp.kernel.org (Postfix) with ESMTPSA id 10C111F000CE; Fri, 4 Dec 2026 12:57:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796389021; bh=qTSkMMn5tUgnjdXt6JT1TL7J3C+yemRlPi+u1A2k/fw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ES0lzA7dHntrTcVRyXa2L5M0530EMYaxmQzFdD1YvlOFEVvWXGtK0Rt4MrHEh6Fhc fQgIyKCqsl631Q9qS6Cj78Ho+3dPBi382vXyvl8vvkx2v6V2gFs1NNSD/+/W4GTrkn LcyiX7v+vcSC1U1x6E9ye9ID8S98ZgchGXkG2HXM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, "Russell King (Oracle)" , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.1 0836/1059] net: phylink: provide phylink_pcs_config() and phylink_pcs_link_up() Date: Fri, 4 Dec 2026 19:06:07 +0900 Message-ID: <20261204100705.683089918@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Russell King (Oracle) [ Upstream commit ae4899bb486f73e6d3d55a82b40482b2c5529a98 ] Add two helper functions for calling PCS methods. phylink_pcs_config() allows us to handle PCS configuration specifics in one location, rather than the two call sites. phylink_pcs_link_up() gives us consistency. Signed-off-by: Russell King (Oracle) Link: https://lore.kernel.org/r/E1q1TzK-007Exd-Rs@rmk-PC.armlinux.org.uk Signed-off-by: Jakub Kicinski Stable-dep-of: fdb6fcabdbb8 ("net: marvell: prestera: disable port before changing its MAC mode") Signed-off-by: Sasha Levin --- drivers/net/phy/phylink.c | 53 ++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index d1463f9cbd711..58ba9ee0d8448 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -964,6 +964,25 @@ static void phylink_resolve_flow(struct phylink_link_state *state) } } +static int phylink_pcs_config(struct phylink_pcs *pcs, unsigned int mode, + const struct phylink_link_state *state, + bool permit_pause_to_mac) +{ + if (!pcs) + return 0; + + return pcs->ops->pcs_config(pcs, mode, state->interface, + state->advertising, permit_pause_to_mac); +} + +static void phylink_pcs_link_up(struct phylink_pcs *pcs, unsigned int mode, + phy_interface_t interface, int speed, + int duplex) +{ + if (pcs && pcs->ops->pcs_link_up) + pcs->ops->pcs_link_up(pcs, mode, interface, speed, duplex); +} + static void phylink_pcs_poll_stop(struct phylink *pl) { if (pl->cfg_link_an_mode == MLO_AN_INBAND) @@ -1046,18 +1065,15 @@ static void phylink_major_config(struct phylink *pl, bool restart, phylink_mac_config(pl, state); - if (pl->pcs) { - err = pl->pcs->ops->pcs_config(pl->pcs, pl->cur_link_an_mode, - state->interface, - state->advertising, - !!(pl->link_config.pause & - MLO_PAUSE_AN)); - if (err < 0) - phylink_err(pl, "pcs_config failed: %pe\n", - ERR_PTR(err)); - if (err > 0) - restart = true; - } + err = phylink_pcs_config(pl->pcs, pl->cur_link_an_mode, state, + !!(pl->link_config.pause & + MLO_PAUSE_AN)); + if (err < 0) + phylink_err(pl, "pcs_config failed: %pe\n", + ERR_PTR(err)); + else if (err > 0) + restart = true; + if (restart) phylink_mac_pcs_an_restart(pl); @@ -1108,11 +1124,9 @@ static int phylink_change_inband_advert(struct phylink *pl) * restart negotiation if the pcs_config() helper indicates that * the programmed advertisement has changed. */ - ret = pl->pcs->ops->pcs_config(pl->pcs, pl->cur_link_an_mode, - pl->link_config.interface, - pl->link_config.advertising, - !!(pl->link_config.pause & - MLO_PAUSE_AN)); + ret = phylink_pcs_config(pl->pcs, pl->cur_link_an_mode, + &pl->link_config, + !!(pl->link_config.pause & MLO_PAUSE_AN)); if (ret < 0) return ret; @@ -1243,9 +1257,8 @@ static void phylink_link_up(struct phylink *pl, pl->cur_interface = link_state.interface; - if (pl->pcs && pl->pcs->ops->pcs_link_up) - pl->pcs->ops->pcs_link_up(pl->pcs, pl->cur_link_an_mode, - pl->cur_interface, speed, duplex); + phylink_pcs_link_up(pl->pcs, pl->cur_link_an_mode, pl->cur_interface, + speed, duplex); pl->mac_ops->mac_link_up(pl->config, pl->phydev, pl->cur_link_an_mode, pl->cur_interface, speed, duplex, -- 2.53.0