diff options
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-5.15/9059-amd-xgbe-Delay-AN-timeout-during-KR-training.patch')
-rw-r--r-- | meta-amd-bsp/recipes-kernel/linux/linux-yocto-5.15/9059-amd-xgbe-Delay-AN-timeout-during-KR-training.patch | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-5.15/9059-amd-xgbe-Delay-AN-timeout-during-KR-training.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-5.15/9059-amd-xgbe-Delay-AN-timeout-during-KR-training.patch new file mode 100644 index 00000000..7e271dd9 --- /dev/null +++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-5.15/9059-amd-xgbe-Delay-AN-timeout-during-KR-training.patch @@ -0,0 +1,86 @@ +From 501f3c0cbc5b66e66a7ed0fd6990ac78815c68ef Mon Sep 17 00:00:00 2001 +From: Sudheesh Mavila <sudheesh.mavila@amd.com> +Date: Tue, 21 Sep 2021 13:35:10 +0530 +Subject: [PATCH] amd-xgbe: Delay AN timeout during KR training + +xgbe driver uses a timeout to restart AN process if link is down. +This timeout value is reduced to 1 sec to enable fast +synchronization between link partner. + +This adds a requirement to delay AN restart in xgbe_check_link_timeout(), +while KR training is in progress. + +Signed-off-by: Sudheesh Mavila <sudheesh.mavila@amd.com> +Change-Id: I373f3851036ce4c15c2e5704addbc3fa3b4d0707 +Signed-off-by: rgaridap <Ramesh.Garidapuri@amd.com> +--- + drivers/net/ethernet/amd/xgbe/xgbe-mdio.c | 22 +++++++++++++++++++++- + drivers/net/ethernet/amd/xgbe/xgbe.h | 1 + + 2 files changed, 22 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c b/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c +index c3fdcbb1df98..ac8b61f8c79f 100755 +--- a/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c ++++ b/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c +@@ -518,6 +518,7 @@ static enum xgbe_an xgbe_an73_tx_training(struct xgbe_prv_data *pdata, + reg |= XGBE_KR_TRAINING_ENABLE; + reg |= XGBE_KR_TRAINING_START; + XMDIO_WRITE(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_10GBR_PMD_CTRL, reg); ++ pdata->kr_start_time = jiffies; + + netif_dbg(pdata, link, pdata->netdev, + "KR training initiated\n"); +@@ -654,6 +655,8 @@ static enum xgbe_an xgbe_an73_incompat_link(struct xgbe_prv_data *pdata) + + xgbe_switch_mode(pdata); + ++ pdata->an_result = XGBE_AN_READY; ++ + xgbe_an_restart(pdata); + + return XGBE_AN_INCOMPAT_LINK; +@@ -1316,11 +1319,28 @@ static bool xgbe_phy_aneg_done(struct xgbe_prv_data *pdata) + static void xgbe_check_link_timeout(struct xgbe_prv_data *pdata) + { + unsigned long link_timeout; ++ int wait = 100; ++ unsigned long kr_time; + + link_timeout = pdata->link_check + (XGBE_LINK_TIMEOUT * HZ); + if (time_after(jiffies, link_timeout)) { + netif_dbg(pdata, link, pdata->netdev, "AN link timeout\n"); +- xgbe_phy_config_aneg(pdata); ++ /* AN restart should not happen within 500ms from start KR training ++ * This loop ensures no AN restart during KR training ++ */ ++ while (wait--) { ++ mutex_lock(&pdata->an_mutex); ++ kr_time = pdata->kr_start_time + msecs_to_jiffies(XGBE_AN_MS_TIMEOUT); ++ mutex_unlock(&pdata->an_mutex); ++ if (time_after(jiffies, kr_time)) ++ break; ++ if (pdata->an_result == XGBE_AN_COMPLETE) ++ break; ++ usleep_range(5000, 6000); ++ } ++ /* AN restart is required, if AN result is not COMPLETE */ ++ if (pdata->an_result != XGBE_AN_COMPLETE) ++ xgbe_phy_config_aneg(pdata); + } + } + +diff --git a/drivers/net/ethernet/amd/xgbe/xgbe.h b/drivers/net/ethernet/amd/xgbe/xgbe.h +index 2c244aa15c27..c1a3b208b1ce 100644 +--- a/drivers/net/ethernet/amd/xgbe/xgbe.h ++++ b/drivers/net/ethernet/amd/xgbe/xgbe.h +@@ -1267,6 +1267,7 @@ struct xgbe_prv_data { + unsigned int fec_ability; + unsigned long an_start; + enum xgbe_an_mode an_mode; ++ unsigned long kr_start_time; + + /* I2C support */ + struct xgbe_i2c i2c; +-- +2.37.3 + |