net/txgbe: fix link up and down
authorJiawen Wu <jiawenwu@trustnetic.com>
Wed, 9 Feb 2022 10:42:12 +0000 (18:42 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 11 Feb 2022 12:49:13 +0000 (13:49 +0100)
Add hw->dev_start status in the flow of setting link up/down, to avoid
obtaining link status inconsistent with the settings.

Fixes: 12a653eb53e1 ("net/txgbe: fix link status when device stopped")
Cc: stable@dpdk.org
Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
drivers/net/txgbe/txgbe_ethdev.c

index b756ea5..7b42285 100644 (file)
@@ -1933,6 +1933,7 @@ txgbe_dev_set_link_up(struct rte_eth_dev *dev)
        } else {
                /* Turn on the laser */
                hw->mac.enable_tx_laser(hw);
+               hw->dev_start = true;
                txgbe_dev_link_update(dev, 0);
        }
 
@@ -1953,6 +1954,7 @@ txgbe_dev_set_link_down(struct rte_eth_dev *dev)
        } else {
                /* Turn off the laser */
                hw->mac.disable_tx_laser(hw);
+               hw->dev_start = false;
                txgbe_dev_link_update(dev, 0);
        }