net/i40e: return unknown speed in status
authorIvan Dyukov <i.dyukov@samsung.com>
Tue, 11 Aug 2020 08:52:24 +0000 (11:52 +0300)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 18 Sep 2020 16:55:07 +0000 (18:55 +0200)
rte_ethdev has declared new NUM_UNKNOWN speed which
could be used in case when no speed information is available and
link is up. NUM_NONE should be returned, if link is down.

Signed-off-by: Ivan Dyukov <i.dyukov@samsung.com>
Acked-by: Jeff Guo <jia.guo@intel.com>
drivers/net/i40e/i40e_ethdev.c
drivers/net/i40e/i40e_ethdev_vf.c

index 11c02b1..8414472 100644 (file)
@@ -3014,7 +3014,10 @@ update_link_aq(struct i40e_hw *hw, struct rte_eth_link *link,
                link->link_speed = ETH_SPEED_NUM_40G;
                break;
        default:
-               link->link_speed = ETH_SPEED_NUM_NONE;
+               if (link->link_status)
+                       link->link_speed = ETH_SPEED_NUM_UNKNOWN;
+               else
+                       link->link_speed = ETH_SPEED_NUM_NONE;
                break;
        }
 }
index b4e4293..ac6c25b 100644 (file)
@@ -2208,15 +2208,15 @@ i40evf_dev_link_update(struct rte_eth_dev *dev,
                new_link.link_speed = ETH_SPEED_NUM_40G;
                break;
        default:
-               new_link.link_speed = ETH_SPEED_NUM_NONE;
+               if (vf->link_up)
+                       new_link.link_speed = ETH_SPEED_NUM_UNKNOWN;
+               else
+                       new_link.link_speed = ETH_SPEED_NUM_NONE;
                break;
        }
        /* full duplex only */
        new_link.link_duplex = ETH_LINK_FULL_DUPLEX;
-       new_link.link_status = vf->link_up &&
-                               new_link.link_speed != ETH_SPEED_NUM_NONE
-                               ? ETH_LINK_UP
-                               : ETH_LINK_DOWN;
+       new_link.link_status = vf->link_up ? ETH_LINK_UP : ETH_LINK_DOWN;
        new_link.link_autoneg =
                !(dev->data->dev_conf.link_speeds & ETH_LINK_SPEED_FIXED);