net/enic: extract code for checking link status
authorNelson Escobar <neescoba@cisco.com>
Mon, 19 Sep 2016 18:50:10 +0000 (11:50 -0700)
committerBruce Richardson <bruce.richardson@intel.com>
Fri, 30 Sep 2016 10:27:18 +0000 (12:27 +0200)
Move link check code to a new function so that it can be reused
by the interrupt handler.

Signed-off-by: Nelson Escobar <neescoba@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
drivers/net/enic/enic.h
drivers/net/enic/enic_ethdev.c
drivers/net/enic/enic_main.c

index 4c16ef1..5c9345f 100644 (file)
@@ -273,4 +273,5 @@ uint16_t enic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 uint16_t enic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
                               uint16_t nb_pkts);
 int enic_set_mtu(struct enic *enic, uint16_t new_mtu);
+int enic_link_update(struct enic *enic);
 #endif /* _ENIC_H_ */
index 6c8a779..da2abd9 100644 (file)
@@ -432,17 +432,9 @@ static int enicpmd_dev_link_update(struct rte_eth_dev *eth_dev,
        __rte_unused int wait_to_complete)
 {
        struct enic *enic = pmd_priv(eth_dev);
-       int ret;
-       int link_status = 0;
 
        ENICPMD_FUNC_TRACE();
-       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;
+       return enic_link_update(enic);
 }
 
 static void enicpmd_dev_stats_get(struct rte_eth_dev *eth_dev,
index aafdc64..a0283ca 100644 (file)
@@ -411,6 +411,21 @@ enic_free_consistent(void *priv,
        rte_free(mze);
 }
 
+int enic_link_update(struct enic *enic)
+{
+       struct rte_eth_dev *eth_dev = enic->rte_dev;
+       int ret;
+       int link_status = 0;
+
+       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;
+}
+
 static void
 enic_intr_handler(__rte_unused struct rte_intr_handle *handle,
        void *arg)