net/enic: use link status helper functions
authorStephen Hemminger <stephen@networkplumber.org>
Fri, 26 Jan 2018 02:01:51 +0000 (18:01 -0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 30 Mar 2018 12:08:43 +0000 (14:08 +0200)
Use new rte_eth_linkstatus_get/set helper functions to handle link
status update.

This driver was not doing atomic update of link status information.
And the return value was different than others.
The hardware also does not do autonegotiation (at least on Linux).

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
drivers/net/enic/enic_ethdev.c
drivers/net/enic/enic_main.c

index 2a289b6..03f0c25 100644 (file)
@@ -423,10 +423,9 @@ static void enicpmd_dev_stop(struct rte_eth_dev *eth_dev)
 
        ENICPMD_FUNC_TRACE();
        enic_disable(enic);
+
        memset(&link, 0, sizeof(link));
-       rte_atomic64_cmpset((uint64_t *)&eth_dev->data->dev_link,
-               *(uint64_t *)&eth_dev->data->dev_link,
-               *(uint64_t *)&link);
+       rte_eth_linkstatus_set(eth_dev, &link);
 }
 
 /*
index 77eb34c..69ad425 100644 (file)
@@ -403,16 +403,14 @@ enic_free_consistent(void *priv,
 int enic_link_update(struct enic *enic)
 {
        struct rte_eth_dev *eth_dev = enic->rte_dev;
-       int ret;
-       int link_status = 0;
+       struct rte_eth_link link;
 
-       link_status = enic_get_link_status(enic);
-       ret = (link_status == enic->link_status);
-       enic->link_status = link_status;
-       eth_dev->data->dev_link.link_status = link_status;
-       eth_dev->data->dev_link.link_duplex = ETH_LINK_FULL_DUPLEX;
-       eth_dev->data->dev_link.link_speed = vnic_dev_port_speed(enic->vdev);
-       return ret;
+       memset(&link, 0, sizeof(link));
+       link.link_status = enic_get_link_status(enic);
+       link.link_duplex = ETH_LINK_FULL_DUPLEX;
+       link.link_speed = vnic_dev_port_speed(enic->vdev);
+
+       return rte_eth_linkstatus_set(eth_dev, &link);
 }
 
 static void