net/sfc: fix link status when port is not started
authorAndrew Rybchenko <arybchenko@solarflare.com>
Thu, 12 Jan 2017 09:03:22 +0000 (09:03 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 30 Jan 2017 21:18:25 +0000 (22:18 +0100)
Fixes: 886f8d8a05bf ("net/sfc: retrieve link info")

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andrew Lee <alee@solarflare.com>
drivers/net/sfc/sfc_ethdev.c

index d13b6d6..3ad9ada 100644 (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)