net/txgbe: fix link status when device stopped

When device is stopped, the port status is not changed and only the Tx
laser is turned off by hardware design.

Fixes: 0c061eadec ("net/txgbe: add link status change")
Cc: stable@dpdk.org

Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
This commit is contained in:
Jiawen Wu 2021-08-12 10:00:18 +08:00 committed by Ferruh Yigit
parent 8d7a59f171
commit 12a653eb53
3 changed files with 7 additions and 0 deletions

View File

@ -781,6 +781,7 @@ struct txgbe_hw {
int api_version;
bool allow_unsupported_sfp;
bool need_crosstalk_fix;
bool dev_start;
struct txgbe_devargs devarg;
uint64_t isb_dma;

View File

@ -1664,6 +1664,7 @@ txgbe_dev_start(struct rte_eth_dev *dev)
return -1;
hw->mac.start_hw(hw);
hw->mac.get_link_status = true;
hw->dev_start = true;
/* configure PF module if SRIOV enabled */
txgbe_pf_host_configure(dev);
@ -1933,6 +1934,7 @@ txgbe_dev_stop(struct rte_eth_dev *dev)
hw->adapter_stopped = true;
dev->data->dev_started = 0;
hw->dev_start = false;
return 0;
}
@ -2735,6 +2737,8 @@ txgbe_dev_link_update_share(struct rte_eth_dev *dev,
txgbe_dev_setup_link_alarm_handler, dev);
}
return rte_eth_linkstatus_set(dev, &link);
} else if (!hw->dev_start) {
return rte_eth_linkstatus_set(dev, &link);
}
intr->flags &= ~TXGBE_FLAG_NEED_LINK_CONFIG;

View File

@ -628,6 +628,7 @@ txgbevf_dev_start(struct rte_eth_dev *dev)
return err;
}
hw->mac.get_link_status = true;
hw->dev_start = true;
/* negotiate mailbox API version to use with the PF. */
txgbevf_negotiate_api(hw);
@ -749,6 +750,7 @@ txgbevf_dev_stop(struct rte_eth_dev *dev)
}
adapter->rss_reta_updated = 0;
hw->dev_start = false;
return 0;
}