Skip to content

Commit

Permalink
net/txgbe: keep link down after device close
Browse files Browse the repository at this point in the history
[ upstream commit 409a08c34fd20a25dd209438f52cb38ace081b19 ]

When the port is closed, hardware is reset to power on. And
txgbe_dev_stop() is just returned 0 to avoid secondary calls,
so that the link led remains on. Fix this bug by adding to turn
off the copper/laser.

Fixes: e0d876e ("net/txgbe: support device stop and close")

Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
  • Loading branch information
Jiawen Wu authored and kevintraynor committed Oct 31, 2023
1 parent 709992f commit a3d1c5e
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions drivers/net/txgbe/txgbe_ethdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1882,7 +1882,7 @@ txgbe_dev_stop(struct rte_eth_dev *dev)
struct txgbe_tm_conf *tm_conf = TXGBE_DEV_TM_CONF(dev);

if (hw->adapter_stopped)
return 0;
goto out;

PMD_INIT_FUNC_TRACE();

Expand All @@ -1901,14 +1901,6 @@ txgbe_dev_stop(struct rte_eth_dev *dev)
for (vf = 0; vfinfo != NULL && vf < pci_dev->max_vfs; vf++)
vfinfo[vf].clear_to_send = false;

if (hw->phy.media_type == txgbe_media_type_copper) {
/* Turn off the copper */
hw->phy.set_phy_power(hw, false);
} else {
/* Turn off the laser */
hw->mac.disable_tx_laser(hw);
}

txgbe_dev_clear_queues(dev);

/* Clear stored conf */
Expand Down Expand Up @@ -1939,6 +1931,16 @@ txgbe_dev_stop(struct rte_eth_dev *dev)
dev->data->dev_started = 0;
hw->dev_start = false;

out:
/* close phy to prevent reset in dev_close from restarting physical link */
if (hw->phy.media_type == txgbe_media_type_copper) {
/* Turn off the copper */
hw->phy.set_phy_power(hw, false);
} else {
/* Turn off the laser */
hw->mac.disable_tx_laser(hw);
}

return 0;
}

Expand Down

0 comments on commit a3d1c5e

Please sign in to comment.