From patchwork Wed Feb 26 07:48:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Choong Yong Liang X-Patchwork-Id: 13991675 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4487AC021B8 for ; Wed, 26 Feb 2025 07:54:39 +0000 (UTC) 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:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=MPNivs7tAW9dhovr2IKP5tQ+ZIfCJHDwlOhx8vmtcb4=; b=VzBB4ZLWYS8xB828mLfg/GhdO/ RQefpbordT1Aky42kaXnypJ8w1y6AlfsykmXm5Cc2xnYfGg/1flbR4EFWape+1QHUDrB/esUNEdOX 2Uw+EOIjqBnt3jVMEwaUlS4WlrGzy1UxQmqmllO5XbB9zM3N5tVuyHkIlONgJHakYsVFTliu6Qhzn fnBu8tYAsEoQ+hpsvqULTDzkB0dJs5wyYeS/zelI8Gm7JvMxUo3vrpPvuS8mJjoMfrUfajgBv47pp DtcbccR1P3cmrjdAsSOKOszohN9UG+0aU7Jgvb715JRQifdAINiFtqUy0xf5KPD0I2LJ7x6Af2TNh h+lGybRQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tnCFR-00000002lIM-22QH; Wed, 26 Feb 2025 07:54:29 +0000 Received: from mgamail.intel.com ([192.198.163.12]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tnCBE-00000002jx3-3xpC for linux-arm-kernel@lists.infradead.org; Wed, 26 Feb 2025 07:50:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1740556209; x=1772092209; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/F6h0Wk9IIXl2ia8BB5p48JcW81JQzIVGqJlZplnJaA=; b=HrHClTdM5xE/YXF7WgcCpAFHClI4j842UYJyR3j1e1N8jW2bWw4S5ZfK Nz+RRjyKGFQkd06HkiyNzFVFGzPw7FUo0NbeyOzt39Z8+Hk6cX3HZhhRo BR5lPoowSlXuUOcHB+hfx4zar9LCfzkx2MGIjVvyRW5jFBmoPfmHHHpnT /mDBn0aDzqq2YFXXTvDxf67vQOaMAl/U7ZRxLuyQV2JyUpNsQKL+RLbZd Wsgix8t6Moq2aMYsZbp54kzGnbV24oavBp1pEbFf6fp0HX/gT7mhyi46r LY8XdpeceW8rugU6ZtupTvsfb2xnQSc7bRqu15WwVGp/x7PmkcHYgcqUh w==; X-CSE-ConnectionGUID: OHy1gwgDSH25lI8bimo8FQ== X-CSE-MsgGUID: W7jInEXPTGGlR1sdW3a6PQ== X-IronPort-AV: E=McAfee;i="6700,10204,11356"; a="45305021" X-IronPort-AV: E=Sophos;i="6.13,316,1732608000"; d="scan'208";a="45305021" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Feb 2025 23:50:03 -0800 X-CSE-ConnectionGUID: IDEX3NLXTR+KVLSiNHhDAw== X-CSE-MsgGUID: ZYfdAKhnT2qqhUUprkUT/Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="120742958" Received: from yongliang-ubuntu20-ilbpg12.png.intel.com ([10.88.227.39]) by fmviesa003.fm.intel.com with ESMTP; 25 Feb 2025 23:49:56 -0800 From: Choong Yong Liang To: Simon Horman , Jose Abreu , Jose Abreu , David E Box , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H . Peter Anvin" , Rajneesh Bhardwaj , David E Box , Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Alexandre Torgue , Jiawen Wu , Mengyuan Lou , Heiner Kallweit , Russell King , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Richard Cochran , Serge Semin Cc: x86@kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH net-next v8 1/6] net: phylink: use pl->link_interface in phylink_expects_phy() Date: Wed, 26 Feb 2025 15:48:32 +0800 Message-Id: <20250226074837.1679988-2-yong.liang.choong@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250226074837.1679988-1-yong.liang.choong@linux.intel.com> References: <20250226074837.1679988-1-yong.liang.choong@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250225_235009_030475_90A464B5 X-CRM114-Status: GOOD ( 11.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The phylink_expects_phy() function allows MAC drivers to check if they are expecting a PHY to attach. The checking condition in phylink_expects_phy() aims to achieve the same result as the checking condition in phylink_attach_phy(). However, the checking condition in phylink_expects_phy() uses pl->link_config.interface, while phylink_attach_phy() uses pl->link_interface. Initially, both pl->link_interface and pl->link_config.interface are set to SGMII, and pl->cfg_link_an_mode is set to MLO_AN_INBAND. When the interface switches from SGMII to 2500BASE-X, pl->link_config.interface is updated by phylink_major_config(). At this point, pl->cfg_link_an_mode remains MLO_AN_INBAND, and pl->link_config.interface is set to 2500BASE-X. Subsequently, when the STMMAC link goes down and comes up again, it is blocked by phylink_expects_phy(). Since phylink_expects_phy() and phylink_attach_phy() aim to achieve the same result, phylink_expects_phy() should check pl->link_interface, which never changes, instead of pl->link_config.interface, which is updated by phylink_major_config(). Signed-off-by: Choong Yong Liang Reviewed-by: Russell King (Oracle) --- drivers/net/phy/phylink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index a3b186ab3854..a3f64b6d2d34 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -2044,7 +2044,7 @@ bool phylink_expects_phy(struct phylink *pl) { if (pl->cfg_link_an_mode == MLO_AN_FIXED || (pl->cfg_link_an_mode == MLO_AN_INBAND && - phy_interface_mode_is_8023z(pl->link_config.interface))) + phy_interface_mode_is_8023z(pl->link_interface))) return false; return true; }