From patchwork Thu Feb 27 12:15:17 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: 13994340 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 012F522DF8F; Thu, 27 Feb 2025 12:16:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658611; cv=none; b=E5JO0oY0QLPPLDgZwFcwB/zRdhQ5Va/HSK4OrfecKekk8Am+0njijTy4XWQcJZl/Sw5acfUEBthPZNYd0vLeiBkVStVuxw4XU5CWULCb0WRVsWWoneIT7x5Wq8sbR72APTYV8xt5ExRwkSVuYQZxWtzY89NVRNT7d5X3QsaDQUk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740658611; c=relaxed/simple; bh=NYawYn9fgjJ9B2nyK205uvx2Cn8hPNrYyHvM0GhLl6w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=nujyUwaBEL5jxpA8S2z+67C6yoLlCA2XXHT2sbeAMibDoJvibt60KAurYq8NTsWslh9J0TdlC2rQizzmA/egqMJJ6Z9UHgqC+82uzBftOOEwBaJfeeLAmliL6IYVjTK29M5w+p3x3dQlrZ3Pk6xW4oOr04v7SAY/5Y5YeIdFVII= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=HQOnljVK; arc=none smtp.client-ip=198.175.65.21 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="HQOnljVK" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1740658610; x=1772194610; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=NYawYn9fgjJ9B2nyK205uvx2Cn8hPNrYyHvM0GhLl6w=; b=HQOnljVK54xaNISdUxLcaihl8D6CJxkB5VUg+EWNh7KTvuoR2UOluzs/ fVouxcmju7gc0xgII9Fd7HYNlh16qxSV9q94RcjYmI9/45B16ErBQH2C+ GlcmzhHqcnBpQhLAAYvAe76ZiatpPaIwVAW1cCOa/opBL20aGji9N0Rxh rdfDxuxVMEr441zwwOPpdOawohTCNTgOqA2Smm9fxWVppLy9Lb7FM/Ion VREq2/8S0KI2JwxnDa2DJlwJ1vL2TCmrM8rDeYEJZ74OVG/MxWlajdFkj QkZ7j4XDMxPnOwuhkN97UMI9UyJBTl4tAFAfRDoU0OxIFAdvMVJUneJnA g==; X-CSE-ConnectionGUID: JcQeJ4lXS2usLbWW0xfFVQ== X-CSE-MsgGUID: tZzVDHrAThimRBCvnPBU/Q== X-IronPort-AV: E=McAfee;i="6700,10204,11358"; a="41464295" X-IronPort-AV: E=Sophos;i="6.13,319,1732608000"; d="scan'208";a="41464295" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Feb 2025 04:16:49 -0800 X-CSE-ConnectionGUID: Nl22v1fXTTeGGVjyJnRpgA== X-CSE-MsgGUID: e9rhUHc2SZS3HBqF1ZQxJA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="117519106" Received: from yongliang-ubuntu20-ilbpg12.png.intel.com ([10.88.227.39]) by orviesa007.jf.intel.com with ESMTP; 27 Feb 2025 04:16:42 -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 v9 1/6] net: phylink: use pl->link_interface in phylink_expects_phy() Date: Thu, 27 Feb 2025 20:15:17 +0800 Message-Id: <20250227121522.1802832-2-yong.liang.choong@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250227121522.1802832-1-yong.liang.choong@linux.intel.com> References: <20250227121522.1802832-1-yong.liang.choong@linux.intel.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 interface is taken down administratively and brought back up, 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(). Reviewed-by: Russell King (Oracle) Signed-off-by: Choong Yong Liang --- 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; }