From: Andrew Rybchenko Date: Thu, 12 Jan 2017 09:03:22 +0000 (+0000) Subject: net/sfc: fix link status when port is not started X-Git-Tag: spdx-start~4627 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=9b098c525beb17869afc4952fe9ac403ef3b46c7;p=dpdk.git net/sfc: fix link status when port is not started Fixes: 886f8d8a05bf ("net/sfc: retrieve link info") Signed-off-by: Andrew Rybchenko Reviewed-by: Andrew Lee --- diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index d13b6d69e5..3ad9adafb6 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -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, ¤t_link); + if (!rte_atomic64_cmpset((volatile uint64_t *)dev_link, + *(uint64_t *)&old_link, + *(uint64_t *)¤t_link)) + goto retry; + } else if (wait_to_complete) { efx_link_mode_t link_mode; if (efx_port_poll(sa->nic, &link_mode) != 0)