net/cnxk: add TM shaper and node operations
[dpdk.git] / drivers / net / cnxk / cnxk_link.c
index caf35ee..6a70801 100644 (file)
@@ -45,6 +45,29 @@ nix_link_status_print(struct rte_eth_dev *eth_dev, struct rte_eth_link *link)
                plt_info("Port %d: Link Down", (int)(eth_dev->data->port_id));
 }
 
+void
+cnxk_eth_dev_link_status_get_cb(struct roc_nix *nix,
+                               struct roc_nix_link_info *link)
+{
+       struct cnxk_eth_dev *dev = (struct cnxk_eth_dev *)nix;
+       struct rte_eth_link eth_link;
+       struct rte_eth_dev *eth_dev;
+
+       if (!link || !nix)
+               return;
+
+       eth_dev = dev->eth_dev;
+       if (!eth_dev)
+               return;
+
+       rte_eth_linkstatus_get(eth_dev, &eth_link);
+
+       link->status = eth_link.link_status;
+       link->speed = eth_link.link_speed;
+       link->autoneg = eth_link.link_autoneg;
+       link->full_duplex = eth_link.link_duplex;
+}
+
 void
 cnxk_eth_dev_link_status_cb(struct roc_nix *nix, struct roc_nix_link_info *link)
 {
@@ -90,7 +113,7 @@ cnxk_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 (roc_nix_is_sdp(&dev->nix))
+       if (!eth_dev->data->dev_started || roc_nix_is_sdp(&dev->nix))
                return 0;
 
        if (roc_nix_is_lbk(&dev->nix)) {