public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 net 0/3] amd-xgbe: RX adaptation and PHY handling fixes
@ 2026-03-06 11:16 Raju Rangoju
  2026-03-06 11:16 ` [PATCH v3 net 1/3] amd-xgbe: fix link status handling in xgbe_rx_adaptation Raju Rangoju
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Raju Rangoju @ 2026-03-06 11:16 UTC (permalink / raw)
  To: netdev
  Cc: linux-kernel, pabeni, kuba, edumazet, davem, andrew+netdev, horms,
	Shyam-sundar.S-k, Raju Rangoju

This series fixes several issues in the amd-xgbe driver related to RX
adaptation and PHY handling in 10GBASE-KR mode, particularly when
auto-negotiation is disabled.

Patch 1 fixes link status handling during RX adaptation by correctly
reading the latched link status bit so transient link drops are
detected without losing the current state.

Patch 2 prevents CRC errors that can occur when performing RX
adaptation with auto-negotiation turned off. The driver now stops
TX/RX before re-triggering RX adaptation and only re-enables traffic
once adaptation completes and the link is confirmed up, ensuring
packets are not corrupted during the adaptation window.

Patch 3 restores the intended ordering of PHY reset relative to
phy_start(), making sure PHY settings are reset before the PHY is
started instead of afterwards.

Changes since v1:
 - change the data_path_stopped flag to boolean type
   as it is only used as a true/false indicator.

Changes since v2:
 - use the correct fixes tag for the link status handling patch
 - change the data_path_stopped flag to be cleared in phy_start() to
   ensure it is reset on device restart

Raju Rangoju (3):
  amd-xgbe: fix link status handling in xgbe_rx_adaptation
  amd-xgbe: prevent CRC errors during RX adaptation with AN disabled
  amd-xgbe: reset PHY settings before starting PHY

 drivers/net/ethernet/amd/xgbe/xgbe-drv.c    | 19 ++---
 drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 82 +++++++++++++++++++--
 drivers/net/ethernet/amd/xgbe/xgbe.h        |  4 +
 3 files changed, 89 insertions(+), 16 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v3 net 1/3] amd-xgbe: fix link status handling in xgbe_rx_adaptation
  2026-03-06 11:16 [PATCH v3 net 0/3] amd-xgbe: RX adaptation and PHY handling fixes Raju Rangoju
@ 2026-03-06 11:16 ` Raju Rangoju
  2026-03-06 11:16 ` [PATCH v3 net 2/3] amd-xgbe: prevent CRC errors during RX adaptation with AN disabled Raju Rangoju
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Raju Rangoju @ 2026-03-06 11:16 UTC (permalink / raw)
  To: netdev
  Cc: linux-kernel, pabeni, kuba, edumazet, davem, andrew+netdev, horms,
	Shyam-sundar.S-k, Raju Rangoju

The link status bit is latched low to allow detection of momentary
link drops. If the status indicates that the link is already down,
read it again to obtain the current state.

Fixes: 4f3b20bfbb75 ("amd-xgbe: add support for rx-adaptation")
Signed-off-by: Raju Rangoju <Raju.Rangoju@amd.com>
---
 drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
index 1dbfa9d4360d..b330e888c944 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
@@ -1942,7 +1942,7 @@ static void xgbe_set_rx_adap_mode(struct xgbe_prv_data *pdata,
 static void xgbe_rx_adaptation(struct xgbe_prv_data *pdata)
 {
 	struct xgbe_phy_data *phy_data = pdata->phy_data;
-	unsigned int reg;
+	int reg;
 
 	/* step 2: force PCS to send RX_ADAPT Req to PHY */
 	XMDIO_WRITE_BITS(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_RX_EQ_CTRL4,
@@ -1964,11 +1964,20 @@ static void xgbe_rx_adaptation(struct xgbe_prv_data *pdata)
 
 	/* Step 4: Check for Block lock */
 
-	/* Link status is latched low, so read once to clear
-	 * and then read again to get current state
-	 */
-	reg = XMDIO_READ(pdata, MDIO_MMD_PCS, MDIO_STAT1);
 	reg = XMDIO_READ(pdata, MDIO_MMD_PCS, MDIO_STAT1);
+	if (reg < 0)
+		goto set_mode;
+
+	/* Link status is latched low so that momentary link drops
+	 * can be detected. If link was already down read again
+	 * to get the latest state.
+	 */
+	if (!pdata->phy.link && !(reg & MDIO_STAT1_LSTATUS)) {
+		reg = XMDIO_READ(pdata, MDIO_MMD_PCS, MDIO_STAT1);
+		if (reg < 0)
+			goto set_mode;
+	}
+
 	if (reg & MDIO_STAT1_LSTATUS) {
 		/* If the block lock is found, update the helpers
 		 * and declare the link up
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v3 net 2/3] amd-xgbe: prevent CRC errors during RX adaptation with AN disabled
  2026-03-06 11:16 [PATCH v3 net 0/3] amd-xgbe: RX adaptation and PHY handling fixes Raju Rangoju
  2026-03-06 11:16 ` [PATCH v3 net 1/3] amd-xgbe: fix link status handling in xgbe_rx_adaptation Raju Rangoju
@ 2026-03-06 11:16 ` Raju Rangoju
  2026-03-10 11:06   ` Paolo Abeni
  2026-03-06 11:16 ` [PATCH v3 net 3/3] amd-xgbe: reset PHY settings before starting PHY Raju Rangoju
  2026-03-10 11:20 ` [PATCH v3 net 0/3] amd-xgbe: RX adaptation and PHY handling fixes patchwork-bot+netdevbpf
  3 siblings, 1 reply; 6+ messages in thread
From: Raju Rangoju @ 2026-03-06 11:16 UTC (permalink / raw)
  To: netdev
  Cc: linux-kernel, pabeni, kuba, edumazet, davem, andrew+netdev, horms,
	Shyam-sundar.S-k, Raju Rangoju

When operating in 10GBASE-KR mode with auto-negotiation disabled and RX
adaptation enabled, CRC errors can occur during the RX adaptation
process. This happens because the driver continues transmitting and
receiving packets while adaptation is in progress.

Fix this by stopping TX/RX immediately when the link goes down and RX
adaptation needs to be re-triggered, and only re-enabling TX/RX after
adaptation completes and the link is confirmed up. Introduce a flag to
track whether TX/RX was disabled for adaptation so it can be restored
correctly.

This prevents packets from being transmitted or received during the RX
adaptation window and avoids CRC errors from corrupted frames.

The flag tracking the data path state is synchronized with hardware
state in xgbe_start() to prevent stale state after device restarts.
This ensures that after a restart cycle (where xgbe_stop disables
TX/RX and xgbe_start re-enables them), the flag correctly reflects
that the data path is active.

Fixes: 4f3b20bfbb75 ("amd-xgbe: add support for rx-adaptation")
Signed-off-by: Raju Rangoju <Raju.Rangoju@amd.com>
---
Changes since v1:
 - Change the data_path_stopped flag to boolean type
   as it is only used as a true/false indicator.
Changes since v2:
 - change the data_path_stopped flag to be cleared in phy_start() to
   ensure it is reset on device restart

 drivers/net/ethernet/amd/xgbe/xgbe-drv.c    |  4 ++
 drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 63 ++++++++++++++++++++-
 drivers/net/ethernet/amd/xgbe/xgbe.h        |  4 ++
 3 files changed, 69 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
index 8b79d88480db..39da2f811858 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
@@ -1277,6 +1277,10 @@ static int xgbe_start(struct xgbe_prv_data *pdata)
 
 	hw_if->enable_tx(pdata);
 	hw_if->enable_rx(pdata);
+	/* Synchronize flag with hardware state after enabling TX/RX.
+	 * This prevents stale state after device restart cycles.
+	 */
+	pdata->data_path_stopped = false;
 
 	udp_tunnel_nic_reset_ntf(netdev);
 
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
index b330e888c944..59a074ed312a 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
@@ -2017,6 +2017,48 @@ static void xgbe_phy_rx_adaptation(struct xgbe_prv_data *pdata)
 	xgbe_rx_adaptation(pdata);
 }
 
+/*
+ * xgbe_phy_stop_data_path - Stop TX/RX to prevent packet corruption
+ * @pdata: driver private data
+ *
+ * This function stops the data path (TX and RX) to prevent packet
+ * corruption during critical PHY operations like RX adaptation.
+ * Must be called before initiating RX adaptation when link goes down.
+ */
+static void xgbe_phy_stop_data_path(struct xgbe_prv_data *pdata)
+{
+	if (pdata->data_path_stopped)
+		return;
+
+	/* Stop TX/RX to prevent packet corruption during RX adaptation */
+	pdata->hw_if.disable_tx(pdata);
+	pdata->hw_if.disable_rx(pdata);
+	pdata->data_path_stopped = true;
+
+	netif_dbg(pdata, link, pdata->netdev,
+		  "stopping data path for RX adaptation\n");
+}
+
+/*
+ * xgbe_phy_start_data_path - Re-enable TX/RX after RX adaptation
+ * @pdata: driver private data
+ *
+ * This function re-enables the data path (TX and RX) after RX adaptation
+ * has completed successfully. Only called when link is confirmed up.
+ */
+static void xgbe_phy_start_data_path(struct xgbe_prv_data *pdata)
+{
+	if (!pdata->data_path_stopped)
+		return;
+
+	pdata->hw_if.enable_rx(pdata);
+	pdata->hw_if.enable_tx(pdata);
+	pdata->data_path_stopped = false;
+
+	netif_dbg(pdata, link, pdata->netdev,
+		  "restarting data path after RX adaptation\n");
+}
+
 static void xgbe_phy_rx_reset(struct xgbe_prv_data *pdata)
 {
 	int reg;
@@ -2826,13 +2868,27 @@ static int xgbe_phy_link_status(struct xgbe_prv_data *pdata, int *an_restart)
 	if (pdata->en_rx_adap) {
 		/* if the link is available and adaptation is done,
 		 * declare link up
+		 *
+		 * Note: When link is up and adaptation is done, we can
+		 * safely re-enable the data path if it was stopped
+		 * for adaptation.
 		 */
-		if ((reg & MDIO_STAT1_LSTATUS) && pdata->rx_adapt_done)
+		if ((reg & MDIO_STAT1_LSTATUS) && pdata->rx_adapt_done) {
+			xgbe_phy_start_data_path(pdata);
 			return 1;
+		}
 		/* If either link is not available or adaptation is not done,
 		 * retrigger the adaptation logic. (if the mode is not set,
 		 * then issue mailbox command first)
 		 */
+
+		/* CRITICAL: Stop data path BEFORE triggering RX adaptation
+		 * to prevent CRC errors from packets corrupted during
+		 * the adaptation process. This is especially important
+		 * when AN is OFF in 10G KR mode.
+		 */
+		xgbe_phy_stop_data_path(pdata);
+
 		if (pdata->mode_set) {
 			xgbe_phy_rx_adaptation(pdata);
 		} else {
@@ -2840,8 +2896,11 @@ static int xgbe_phy_link_status(struct xgbe_prv_data *pdata, int *an_restart)
 			xgbe_phy_set_mode(pdata, phy_data->cur_mode);
 		}
 
-		if (pdata->rx_adapt_done)
+		if (pdata->rx_adapt_done) {
+			/* Adaptation complete, safe to re-enable data path */
+			xgbe_phy_start_data_path(pdata);
 			return 1;
+		}
 	} else if (reg & MDIO_STAT1_LSTATUS)
 		return 1;
 
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe.h b/drivers/net/ethernet/amd/xgbe/xgbe.h
index 4333d269ee84..7f125d2b20c2 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe.h
+++ b/drivers/net/ethernet/amd/xgbe/xgbe.h
@@ -1266,6 +1266,10 @@ struct xgbe_prv_data {
 	bool en_rx_adap;
 	int rx_adapt_retries;
 	bool rx_adapt_done;
+	/* Flag to track if data path (TX/RX) was stopped for RX adaptation.
+	 * This prevents packet corruption during the adaptation window.
+	 */
+	bool data_path_stopped;
 	bool mode_set;
 	bool sph;
 };
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v3 net 3/3] amd-xgbe: reset PHY settings before starting PHY
  2026-03-06 11:16 [PATCH v3 net 0/3] amd-xgbe: RX adaptation and PHY handling fixes Raju Rangoju
  2026-03-06 11:16 ` [PATCH v3 net 1/3] amd-xgbe: fix link status handling in xgbe_rx_adaptation Raju Rangoju
  2026-03-06 11:16 ` [PATCH v3 net 2/3] amd-xgbe: prevent CRC errors during RX adaptation with AN disabled Raju Rangoju
@ 2026-03-06 11:16 ` Raju Rangoju
  2026-03-10 11:20 ` [PATCH v3 net 0/3] amd-xgbe: RX adaptation and PHY handling fixes patchwork-bot+netdevbpf
  3 siblings, 0 replies; 6+ messages in thread
From: Raju Rangoju @ 2026-03-06 11:16 UTC (permalink / raw)
  To: netdev
  Cc: linux-kernel, pabeni, kuba, edumazet, davem, andrew+netdev, horms,
	Shyam-sundar.S-k, Raju Rangoju, Maxime Chevallier

commit f93505f35745 ("amd-xgbe: let the MAC manage PHY PM") moved
xgbe_phy_reset() from xgbe_open() to xgbe_start(), placing it after
phy_start(). As a result, the PHY settings were being reset after the
PHY had already started.

Reorder the calls so that the PHY settings are reset before
phy_start() is invoked.

Fixes: f93505f35745 ("amd-xgbe: let the MAC manage PHY PM")
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Signed-off-by: Raju Rangoju <Raju.Rangoju@amd.com>
---
 drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
index 39da2f811858..23beea48ae26 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
@@ -1271,6 +1271,12 @@ static int xgbe_start(struct xgbe_prv_data *pdata)
 	if (ret)
 		goto err_napi;
 
+	/* Reset the phy settings */
+	ret = xgbe_phy_reset(pdata);
+	if (ret)
+		goto err_irqs;
+
+	/* Start the phy */
 	ret = phy_if->phy_start(pdata);
 	if (ret)
 		goto err_irqs;
@@ -1284,11 +1290,6 @@ static int xgbe_start(struct xgbe_prv_data *pdata)
 
 	udp_tunnel_nic_reset_ntf(netdev);
 
-	/* Reset the phy settings */
-	ret = xgbe_phy_reset(pdata);
-	if (ret)
-		goto err_txrx;
-
 	netif_tx_start_all_queues(netdev);
 
 	xgbe_start_timers(pdata);
@@ -1298,10 +1299,6 @@ static int xgbe_start(struct xgbe_prv_data *pdata)
 
 	return 0;
 
-err_txrx:
-	hw_if->disable_rx(pdata);
-	hw_if->disable_tx(pdata);
-
 err_irqs:
 	xgbe_free_irqs(pdata);
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v3 net 2/3] amd-xgbe: prevent CRC errors during RX adaptation with AN disabled
  2026-03-06 11:16 ` [PATCH v3 net 2/3] amd-xgbe: prevent CRC errors during RX adaptation with AN disabled Raju Rangoju
@ 2026-03-10 11:06   ` Paolo Abeni
  0 siblings, 0 replies; 6+ messages in thread
From: Paolo Abeni @ 2026-03-10 11:06 UTC (permalink / raw)
  To: Raju Rangoju, netdev
  Cc: linux-kernel, kuba, edumazet, davem, andrew+netdev, horms,
	Shyam-sundar.S-k

On 3/6/26 12:16 PM, Raju Rangoju wrote:
> When operating in 10GBASE-KR mode with auto-negotiation disabled and RX
> adaptation enabled, CRC errors can occur during the RX adaptation
> process. This happens because the driver continues transmitting and
> receiving packets while adaptation is in progress.
> 
> Fix this by stopping TX/RX immediately when the link goes down and RX
> adaptation needs to be re-triggered, and only re-enabling TX/RX after
> adaptation completes and the link is confirmed up. Introduce a flag to
> track whether TX/RX was disabled for adaptation so it can be restored
> correctly.
> 
> This prevents packets from being transmitted or received during the RX
> adaptation window and avoids CRC errors from corrupted frames.
> 
> The flag tracking the data path state is synchronized with hardware
> state in xgbe_start() to prevent stale state after device restarts.
> This ensures that after a restart cycle (where xgbe_stop disables
> TX/RX and xgbe_start re-enables them), the flag correctly reflects
> that the data path is active.
> 
> Fixes: 4f3b20bfbb75 ("amd-xgbe: add support for rx-adaptation")
> Signed-off-by: Raju Rangoju <Raju.Rangoju@amd.com>
> ---
> Changes since v1:
>  - Change the data_path_stopped flag to boolean type
>    as it is only used as a true/false indicator.
> Changes since v2:
>  - change the data_path_stopped flag to be cleared in phy_start() to
>    ensure it is reset on device restart
> 
>  drivers/net/ethernet/amd/xgbe/xgbe-drv.c    |  4 ++
>  drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 63 ++++++++++++++++++++-
>  drivers/net/ethernet/amd/xgbe/xgbe.h        |  4 ++
>  3 files changed, 69 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
> index 8b79d88480db..39da2f811858 100644
> --- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
> +++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
> @@ -1277,6 +1277,10 @@ static int xgbe_start(struct xgbe_prv_data *pdata)
>  
>  	hw_if->enable_tx(pdata);
>  	hw_if->enable_rx(pdata);
> +	/* Synchronize flag with hardware state after enabling TX/RX.
> +	 * This prevents stale state after device restart cycles.
> +	 */
> +	pdata->data_path_stopped = false;
>  
>  	udp_tunnel_nic_reset_ntf(netdev);
>  
> diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
> index b330e888c944..59a074ed312a 100644
> --- a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
> +++ b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
> @@ -2017,6 +2017,48 @@ static void xgbe_phy_rx_adaptation(struct xgbe_prv_data *pdata)
>  	xgbe_rx_adaptation(pdata);
>  }
>  
> +/*
> + * xgbe_phy_stop_data_path - Stop TX/RX to prevent packet corruption
> + * @pdata: driver private data
> + *
> + * This function stops the data path (TX and RX) to prevent packet
> + * corruption during critical PHY operations like RX adaptation.
> + * Must be called before initiating RX adaptation when link goes down.
> + */
> +static void xgbe_phy_stop_data_path(struct xgbe_prv_data *pdata)
> +{
> +	if (pdata->data_path_stopped)
> +		return;
> +
> +	/* Stop TX/RX to prevent packet corruption during RX adaptation */
> +	pdata->hw_if.disable_tx(pdata);
> +	pdata->hw_if.disable_rx(pdata);
> +	pdata->data_path_stopped = true;
> +
> +	netif_dbg(pdata, link, pdata->netdev,
> +		  "stopping data path for RX adaptation\n");
> +}
> +
> +/*
> + * xgbe_phy_start_data_path - Re-enable TX/RX after RX adaptation
> + * @pdata: driver private data
> + *
> + * This function re-enables the data path (TX and RX) after RX adaptation
> + * has completed successfully. Only called when link is confirmed up.
> + */
> +static void xgbe_phy_start_data_path(struct xgbe_prv_data *pdata)
> +{
> +	if (!pdata->data_path_stopped)
> +		return;
> +
> +	pdata->hw_if.enable_rx(pdata);
> +	pdata->hw_if.enable_tx(pdata);
> +	pdata->data_path_stopped = false;
> +
> +	netif_dbg(pdata, link, pdata->netdev,
> +		  "restarting data path after RX adaptation\n");
> +}
> +
>  static void xgbe_phy_rx_reset(struct xgbe_prv_data *pdata)
>  {
>  	int reg;
> @@ -2826,13 +2868,27 @@ static int xgbe_phy_link_status(struct xgbe_prv_data *pdata, int *an_restart)
>  	if (pdata->en_rx_adap) {
>  		/* if the link is available and adaptation is done,
>  		 * declare link up
> +		 *
> +		 * Note: When link is up and adaptation is done, we can
> +		 * safely re-enable the data path if it was stopped
> +		 * for adaptation.
>  		 */
> -		if ((reg & MDIO_STAT1_LSTATUS) && pdata->rx_adapt_done)
> +		if ((reg & MDIO_STAT1_LSTATUS) && pdata->rx_adapt_done) {
> +			xgbe_phy_start_data_path(pdata);
>  			return 1;
> +		}
>  		/* If either link is not available or adaptation is not done,
>  		 * retrigger the adaptation logic. (if the mode is not set,
>  		 * then issue mailbox command first)
>  		 */
> +
> +		/* CRITICAL: Stop data path BEFORE triggering RX adaptation
> +		 * to prevent CRC errors from packets corrupted during
> +		 * the adaptation process. This is especially important
> +		 * when AN is OFF in 10G KR mode.
> +		 */
> +		xgbe_phy_stop_data_path(pdata);
> +
>  		if (pdata->mode_set) {
>  			xgbe_phy_rx_adaptation(pdata);
>  		} else {
> @@ -2840,8 +2896,11 @@ static int xgbe_phy_link_status(struct xgbe_prv_data *pdata, int *an_restart)
>  			xgbe_phy_set_mode(pdata, phy_data->cur_mode);
>  		}
>  
> -		if (pdata->rx_adapt_done)
> +		if (pdata->rx_adapt_done) {
> +			/* Adaptation complete, safe to re-enable data path */
> +			xgbe_phy_start_data_path(pdata);
>  			return 1;
> +		}
>  	} else if (reg & MDIO_STAT1_LSTATUS)
>  		return 1;

AI says:

---
What happens if en_rx_adap transitions from true to false while
data_path_stopped is true?

Consider this scenario during an SFP hot-swap from a passive cable (which
enables rx_adap) to an active cable (which disables rx_adap):

1. Initially with passive cable: en_rx_adap=true, link down
2. xgbe_phy_link_status() enters the if (pdata->en_rx_adap) block
3. xgbe_phy_stop_data_path() sets data_path_stopped=true and disables TX/RX
4. Hot-swap to active cable: xgbe_phy_sfi_mode() sets en_rx_adap=0
5. Next call to xgbe_phy_link_status(): en_rx_adap is now false
6. The entire if (pdata->en_rx_adap) block is skipped
7. Link is up, so falls through to: else if (reg & MDIO_STAT1_LSTATUS)
return 1
8. Returns link up, but TX/RX hardware remains disabled

At this point, data_path_stopped=true and the hardware TX/RX is disabled,
but there's no code path to re-enable it when en_rx_adap becomes false
(except a full device restart cycle through xgbe_stop + xgbe_start).

Would it be safer to check data_path_stopped in the else branch and call
xgbe_phy_start_data_path() if needed before returning link up?
---

I think the remark is not correct, as AFAICS xgbe_phy_sfi_mode() is only
invoked by xgbe_phy_link_status(), after checking `en_rx_adap` and ev.
re-starting the ring. Reporting the remark here in case I misread the
code and this actually need a follow-up.

/P


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3 net 0/3] amd-xgbe: RX adaptation and PHY handling fixes
  2026-03-06 11:16 [PATCH v3 net 0/3] amd-xgbe: RX adaptation and PHY handling fixes Raju Rangoju
                   ` (2 preceding siblings ...)
  2026-03-06 11:16 ` [PATCH v3 net 3/3] amd-xgbe: reset PHY settings before starting PHY Raju Rangoju
@ 2026-03-10 11:20 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-03-10 11:20 UTC (permalink / raw)
  To: Raju Rangoju
  Cc: netdev, linux-kernel, pabeni, kuba, edumazet, davem,
	andrew+netdev, horms, Shyam-sundar.S-k

Hello:

This series was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Fri, 6 Mar 2026 16:46:26 +0530 you wrote:
> This series fixes several issues in the amd-xgbe driver related to RX
> adaptation and PHY handling in 10GBASE-KR mode, particularly when
> auto-negotiation is disabled.
> 
> Patch 1 fixes link status handling during RX adaptation by correctly
> reading the latched link status bit so transient link drops are
> detected without losing the current state.
> 
> [...]

Here is the summary with links:
  - [v3,net,1/3] amd-xgbe: fix link status handling in xgbe_rx_adaptation
    https://git.kernel.org/netdev/net/c/6485cb96be5c
  - [v3,net,2/3] amd-xgbe: prevent CRC errors during RX adaptation with AN disabled
    https://git.kernel.org/netdev/net/c/27a4dd0c702b
  - [v3,net,3/3] amd-xgbe: reset PHY settings before starting PHY
    https://git.kernel.org/netdev/net/c/a8ba129af468

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-03-10 11:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-06 11:16 [PATCH v3 net 0/3] amd-xgbe: RX adaptation and PHY handling fixes Raju Rangoju
2026-03-06 11:16 ` [PATCH v3 net 1/3] amd-xgbe: fix link status handling in xgbe_rx_adaptation Raju Rangoju
2026-03-06 11:16 ` [PATCH v3 net 2/3] amd-xgbe: prevent CRC errors during RX adaptation with AN disabled Raju Rangoju
2026-03-10 11:06   ` Paolo Abeni
2026-03-06 11:16 ` [PATCH v3 net 3/3] amd-xgbe: reset PHY settings before starting PHY Raju Rangoju
2026-03-10 11:20 ` [PATCH v3 net 0/3] amd-xgbe: RX adaptation and PHY handling fixes patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox