Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7E64C43334 for ; Mon, 13 Jun 2022 17:35:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237711AbiFMRfo (ORCPT ); Mon, 13 Jun 2022 13:35:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242267AbiFMRe4 (ORCPT ); Mon, 13 Jun 2022 13:34:56 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E548F12E826 for ; Mon, 13 Jun 2022 06:00:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=HrwRonIxblTTouEfPKm9hz2IxHPlaC8X+xGP1hKHvmI=; b=lvjHXEfL6gPiL+Sn+JT1LkYz4m dlOb12ReHf0TKXYiJ9z4e5h/YAndPG54vM5a78fbIA/c9eiX39zE8aMN1gw7jCFVKbk4Vitz4djs+ j+R+aTYcYhHd18n16sG3oCubRv1OBZoGtkekwmvI+4CbW6W0Lm4cW9SVm5tXYePng5r58LRR/A+0X md8+ESq2XTuowV/QJiXZ129ib4k4sjTERK8p5FvNz7zHcA+dx2I5A8gsjkDyRIkebT4BHp6fxbvo/ vZTHfhhgu4epnMEr8Cvfsx6H+gFy21u26dxrbzFY6SVhM7e3GFEWp7NJN6uMHpMQuxo4CnWIJB19E xZYGWOSw==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:52082 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1o0jgQ-0001r2-07; Mon, 13 Jun 2022 14:00:42 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1o0jgP-000JYO-B3; Mon, 13 Jun 2022 14:00:41 +0100 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Marek =?iso-8859-1?Q?Beh=FAn?= Cc: "David S. Miller" , Eric Dumazet , Florian Fainelli , Heiner Kallweit , Jakub Kicinski , netdev@vger.kernel.org, Paolo Abeni , Robert Hancock , Vivien Didelot , Vladimir Oltean Subject: [PATCH net-next 04/15] net: phylink: disable PCS polling over major configuration MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" Message-Id: Sender: Russell King Date: Mon, 13 Jun 2022 14:00:41 +0100 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org While we are performing a major configuration, there is no point having the PCS polling timer running. Stop it before we begin preparing for the configuration change, and restart it only once we've successfully completed the change. Signed-off-by: Russell King (Oracle) --- drivers/net/phy/phylink.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 0ce1602513b9..24ef98950600 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -758,6 +758,18 @@ static void phylink_resolve_flow(struct phylink_link_state *state) } } +static void phylink_pcs_poll_stop(struct phylink *pl) +{ + if (pl->cfg_link_an_mode == MLO_AN_INBAND) + del_timer(&pl->link_poll); +} + +static void phylink_pcs_poll_start(struct phylink *pl) +{ + if (pl->pcs->poll && pl->cfg_link_an_mode == MLO_AN_INBAND) + mod_timer(&pl->link_poll, jiffies + HZ); +} + static void phylink_mac_config(struct phylink *pl, const struct phylink_link_state *state) { @@ -789,6 +801,7 @@ static void phylink_major_config(struct phylink *pl, bool restart, const struct phylink_link_state *state) { struct phylink_pcs *pcs = NULL; + bool pcs_changed = false; int err; phylink_dbg(pl, "major config %s\n", phy_modes(state->interface)); @@ -801,8 +814,12 @@ static void phylink_major_config(struct phylink *pl, bool restart, pcs); return; } + + pcs_changed = pcs && pl->pcs != pcs; } + phylink_pcs_poll_stop(pl); + if (pl->mac_ops->mac_prepare) { err = pl->mac_ops->mac_prepare(pl->config, pl->cur_link_an_mode, state->interface); @@ -816,16 +833,8 @@ static void phylink_major_config(struct phylink *pl, bool restart, /* If we have a new PCS, switch to the new PCS after preparing the MAC * for the change. */ - if (pcs) { + if (pcs_changed) { pl->pcs = pcs; - - if (!pl->phylink_disable_state && - pl->cfg_link_an_mode == MLO_AN_INBAND) { - if (pcs->poll) - mod_timer(&pl->link_poll, jiffies + HZ); - else - del_timer(&pl->link_poll); - } } phylink_mac_config(pl, state); @@ -852,6 +861,8 @@ static void phylink_major_config(struct phylink *pl, bool restart, phylink_err(pl, "mac_finish failed: %pe\n", ERR_PTR(err)); } + + phylink_pcs_poll_start(pl); } /* -- 2.30.2