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 bluca committed Oct 18, 2023
1 parent cc0f220 commit e63070e
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 @@ -1668,7 +1668,7 @@ txgbe_dev_stop(struct rte_eth_dev *dev)
int vf;

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

PMD_INIT_FUNC_TRACE();

Expand All @@ -1687,14 +1687,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 @@ -1724,6 +1716,16 @@ txgbe_dev_stop(struct rte_eth_dev *dev)
hw->adapter_stopped = true;
dev->data->dev_started = 0;

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 e63070e

Please sign in to comment.