net/i40e: fix Rx packet statistics
[dpdk.git] / drivers / net / octeontx2 / otx2_link.c
index 439ec4f..81dd624 100644 (file)
@@ -3,7 +3,7 @@
  */
 
 #include <rte_common.h>
-#include <rte_ethdev_pci.h>
+#include <ethdev_pci.h>
 
 #include "otx2_ethdev.h"
 
@@ -47,6 +47,29 @@ nix_link_status_print(struct rte_eth_dev *eth_dev, struct rte_eth_link *link)
                otx2_info("Port %d: Link Down", (int)(eth_dev->data->port_id));
 }
 
+void
+otx2_eth_dev_link_status_get(struct otx2_dev *dev,
+                            struct cgx_link_user_info *link)
+{
+       struct otx2_eth_dev *otx2_dev = (struct otx2_eth_dev *)dev;
+       struct rte_eth_link eth_link;
+       struct rte_eth_dev *eth_dev;
+
+       if (!link || !dev)
+               return;
+
+       eth_dev = otx2_dev->eth_dev;
+       if (!eth_dev)
+               return;
+
+       rte_eth_linkstatus_get(eth_dev, &eth_link);
+
+       link->link_up = eth_link.link_status;
+       link->speed = eth_link.link_speed;
+       link->an = eth_link.link_autoneg;
+       link->full_duplex = eth_link.link_duplex;
+}
+
 void
 otx2_eth_dev_link_status_update(struct otx2_dev *dev,
                                struct cgx_link_user_info *link)
@@ -125,7 +148,7 @@ otx2_nix_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete)
        RTE_SET_USED(wait_to_complete);
        memset(&link, 0, sizeof(struct rte_eth_link));
 
-       if (otx2_dev_is_sdp(dev))
+       if (!eth_dev->data->dev_started || otx2_dev_is_sdp(dev))
                return 0;
 
        if (otx2_dev_is_lbk(dev))