[8/9] net/ngbe: fix YT PHY mixed mode occasionally failing link

Message ID 20220902030011.377523-9-jiawenwu@trustnetic.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series Wangxun fixes and supports |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Jiawen Wu Sept. 2, 2022, 3 a.m. UTC
  Add to read link status register of UTP mode, to ensure link status of
mixed mode, for YT PHY.

Fixes: 1c44384fce76 ("net/ngbe: support custom PHY interfaces")
Cc: stable@dpdk.org

Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
---
 drivers/net/ngbe/base/ngbe_phy_yt.c | 9 +++++++++
 1 file changed, 9 insertions(+)
  

Patch

diff --git a/drivers/net/ngbe/base/ngbe_phy_yt.c b/drivers/net/ngbe/base/ngbe_phy_yt.c
index 562a0dede5..c88946f7c3 100644
--- a/drivers/net/ngbe/base/ngbe_phy_yt.c
+++ b/drivers/net/ngbe/base/ngbe_phy_yt.c
@@ -463,7 +463,16 @@  s32 ngbe_check_phy_link_yt(struct ngbe_hw *hw,
 
 	if (phy_link) {
 		*link_up = true;
+	} else {
+		status = ngbe_read_phy_reg_mdi(hw, YT_SPST, 0, &phy_data);
+		phy_link = phy_data & YT_SPST_LINK;
+		phy_speed = phy_data & YT_SPST_SPEED_MASK;
+
+		if (phy_link)
+			*link_up = true;
+	}
 
+	if (*link_up) {
 		if (phy_speed == YT_SPST_SPEED_1000M)
 			*speed = NGBE_LINK_SPEED_1GB_FULL;
 		else if (phy_speed == YT_SPST_SPEED_100M)