net/sfc: fix link status when port is not started

Fixes: 886f8d8a05 ("net/sfc: retrieve link info")

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andrew Lee <alee@solarflare.com>
This commit is contained in:
Andrew Rybchenko 2017-01-12 09:03:22 +00:00 committed by Ferruh Yigit
parent f08a237783
commit 9b098c525b

View File

@ -188,14 +188,17 @@ sfc_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete)
sfc_log_init(sa, "entry");
if (sa->state != SFC_ADAPTER_STARTED)
return 0;
retry:
EFX_STATIC_ASSERT(sizeof(*dev_link) == sizeof(rte_atomic64_t));
*(int64_t *)&old_link = rte_atomic64_read((rte_atomic64_t *)dev_link);
if (wait_to_complete) {
if (sa->state != SFC_ADAPTER_STARTED) {
sfc_port_link_mode_to_info(EFX_LINK_UNKNOWN, &current_link);
if (!rte_atomic64_cmpset((volatile uint64_t *)dev_link,
*(uint64_t *)&old_link,
*(uint64_t *)&current_link))
goto retry;
} else if (wait_to_complete) {
efx_link_mode_t link_mode;
if (efx_port_poll(sa->nic, &link_mode) != 0)