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: 13991636 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (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 51FF226E62A; Wed, 26 Feb 2025 07:50:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740556210; cv=none; b=dAa42qY8A9+DK6HE67uBFaWE0ASQuztx2cSRBgCTXY/ibic2BcLD+KSPKUgEmSye9A7xJUvBuavYJdA4p6DdYXP1N5rhZAoLtG91LK79fTZpVpH4nHBulIV4sBwGacWfZ0xKGDxjSo0crt3FmgfKOwTTaHf64A1kFO2ByTW6DUA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740556210; c=relaxed/simple; bh=/F6h0Wk9IIXl2ia8BB5p48JcW81JQzIVGqJlZplnJaA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ADDdYlsYK8ocCaxsa+4NezXjgoAfrtiMnq/gB5gGAr0UMm2129Z5nZmwlPUTNhk4lZvP7E8CsPkcvKbofhaf8TrcmPr/uMKFeP21gp7UJEWiazz+m3WA1HdQuHoUxmgoqIsY49NuQIJSUx31BrcHn2r/ahZYN3vj/pCp5iH+/Sk= 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=iNFoSvO4; arc=none smtp.client-ip=192.198.163.12 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="iNFoSvO4" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1740556208; x=1772092208; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/F6h0Wk9IIXl2ia8BB5p48JcW81JQzIVGqJlZplnJaA=; b=iNFoSvO4f8ljz/w9F5ETZiT8d8z+nha7/8+9lbpM1vzRAJ5aBqroAtF9 h+qyVQKqeE7xbwYAVfGl54BA5D4LWU/8AGvKJfWwu7HtBPiQugaSKa6XU mkaoq1KJoy9p1cINGyVr1sqx3f7b1uXUpGVpHTWXQvBjfQlGQKa/B1I04 2286Lhr8b8zxjczkDHxevOvmTgzHKd9+fL92bIZp8xP1vkScI64yEL9Q5 K0kxKOhs8vZ0Ba5+YHbr5lV/2clYRdxtggMHSnISgRV2lUwwbCN3n6fOs YUv+fruqxRFQBs8IkYJXtq989jK8i2R0HOZJia7TLIFujNuN5oZcbsORL g==; X-CSE-ConnectionGUID: jx7hITMgTse6qmi/tDcGVg== X-CSE-MsgGUID: SxiFci6YQwisH6eSH2qzlg== X-IronPort-AV: E=McAfee;i="6700,10204,11356"; a="45305013" X-IronPort-AV: E=Sophos;i="6.13,316,1732608000"; d="scan'208";a="45305013" 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> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.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; }