net/fm10k: redefine link status semantics
authorXiao Wang <xiao.w.wang@intel.com>
Tue, 24 Oct 2017 13:45:49 +0000 (06:45 -0700)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 26 Oct 2017 00:33:01 +0000 (02:33 +0200)
As fm10k host interface is not directly connected to PHY, marking the
link status as UP doesn't mean a lot to the application.

So, this patch basically redefines the link status as the state of
switch manager: when switch manager is running, it's LINK_UP;
when switch manager goes down by calling the fmTerminate function,
status turns to LINK_DOWN.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
drivers/net/fm10k/fm10k.h
drivers/net/fm10k/fm10k_ethdev.c

index 060982b..594dca4 100644 (file)
@@ -155,6 +155,7 @@ struct fm10k_dev_info {
        struct fm10k_macvlan_filter_info    macvlan;
        /* Flag to indicate if RX vector conditions satisfied */
        bool rx_vec_allowed;
+       bool sm_down;
 };
 
 /*
index 586f482..2587696 100644 (file)
@@ -1256,14 +1256,17 @@ static int
 fm10k_link_update(struct rte_eth_dev *dev,
        __rte_unused int wait_to_complete)
 {
+       struct fm10k_dev_info *dev_info =
+               FM10K_DEV_PRIVATE_TO_INFO(dev->data->dev_private);
        PMD_INIT_FUNC_TRACE();
 
-       /* The host-interface link is always up.  The speed is ~50Gbps per Gen3
-        * x8 PCIe interface. For now, we leave the speed undefined since there
-        * is no 50Gbps Ethernet. */
+       /* The speed is ~50Gbps per Gen3 x8 PCIe interface. For now, we
+        * leave the speed undefined since there is no 50Gbps Ethernet.
+        */
        dev->data->dev_link.link_speed  = 0;
        dev->data->dev_link.link_duplex = ETH_LINK_FULL_DUPLEX;
-       dev->data->dev_link.link_status = ETH_LINK_UP;
+       dev->data->dev_link.link_status =
+               dev_info->sm_down ? ETH_LINK_DOWN : ETH_LINK_UP;
 
        return 0;
 }