Skip to content

Commit

Permalink
net/txgbe/base: fix Tx with fiber hotplug
Browse files Browse the repository at this point in the history
[ upstream commit 196e412b80afe165ca78457d5f9bb1a5bace28ea ]

Under heavy traffic, unplugging and plugging fiber optic cables may cause
Tx failure. The reason is that there is still traffic passing through at
PCS VR reset, during txgbe_set_link_to_*. So totally disable Rx and Tx
before PCS VR reset to fix it.

Fixes: 01c3cf5 ("net/txgbe: add autoneg control read and write")

Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
  • Loading branch information
Jiawen Wu authored and kevintraynor committed Jul 12, 2023
1 parent d98f67c commit 1a77552
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions drivers/net/txgbe/base/txgbe_phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -1519,8 +1519,9 @@ txgbe_set_link_to_kx4(struct txgbe_hw *hw, bool autoneg)
goto out;
}

wr32m(hw, TXGBE_MACTXCFG, TXGBE_MACTXCFG_TXE,
~TXGBE_MACTXCFG_TXE);
wr32m(hw, TXGBE_MACTXCFG, TXGBE_MACTXCFG_TXE, ~TXGBE_MACTXCFG_TXE);
wr32m(hw, TXGBE_MACRXCFG, TXGBE_MACRXCFG_ENA, ~TXGBE_MACRXCFG_ENA);
hw->mac.disable_sec_tx_path(hw);

/* 2. Disable xpcs AN-73 */
if (!autoneg)
Expand Down Expand Up @@ -1734,8 +1735,9 @@ txgbe_set_link_to_kx(struct txgbe_hw *hw,
goto out;
}

wr32m(hw, TXGBE_MACTXCFG, TXGBE_MACTXCFG_TXE,
~TXGBE_MACTXCFG_TXE);
wr32m(hw, TXGBE_MACTXCFG, TXGBE_MACTXCFG_TXE, ~TXGBE_MACTXCFG_TXE);
wr32m(hw, TXGBE_MACRXCFG, TXGBE_MACRXCFG_ENA, ~TXGBE_MACRXCFG_ENA);
hw->mac.disable_sec_tx_path(hw);

/* 2. Disable xpcs AN-73 */
if (!autoneg)
Expand Down Expand Up @@ -1941,8 +1943,9 @@ txgbe_set_link_to_sfi(struct txgbe_hw *hw,
goto out;
}

wr32m(hw, TXGBE_MACTXCFG, TXGBE_MACTXCFG_TXE,
~TXGBE_MACTXCFG_TXE);
wr32m(hw, TXGBE_MACTXCFG, TXGBE_MACTXCFG_TXE, ~TXGBE_MACTXCFG_TXE);
wr32m(hw, TXGBE_MACRXCFG, TXGBE_MACRXCFG_ENA, ~TXGBE_MACRXCFG_ENA);
hw->mac.disable_sec_tx_path(hw);

/* 2. Disable xpcs AN-73 */
wr32_epcs(hw, SR_AN_CTRL, 0x0);
Expand Down Expand Up @@ -2293,6 +2296,8 @@ void txgbe_autoc_write(struct txgbe_hw *hw, u64 autoc)
txgbe_set_sgmii_an37_ability(hw);
}

hw->mac.enable_sec_tx_path(hw);

if (speed == TXGBE_LINK_SPEED_10GB_FULL)
mactxcfg = TXGBE_MACTXCFG_SPEED_10G;
else if (speed == TXGBE_LINK_SPEED_1GB_FULL)
Expand All @@ -2302,6 +2307,7 @@ void txgbe_autoc_write(struct txgbe_hw *hw, u64 autoc)
wr32m(hw, TXGBE_MACTXCFG,
TXGBE_MACTXCFG_SPEED_MASK | TXGBE_MACTXCFG_TXE,
mactxcfg | TXGBE_MACTXCFG_TXE);
wr32m(hw, TXGBE_MACRXCFG, TXGBE_MACRXCFG_ENA, TXGBE_MACRXCFG_ENA);
}

void txgbe_bp_down_event(struct txgbe_hw *hw)
Expand Down

0 comments on commit 1a77552

Please sign in to comment.