use SPDX license tag in Mellanox copyrighted files
[dpdk.git] / drivers / net / cxgbe / cxgbe_main.c
index c786a1a..54eb23d 100644 (file)
@@ -29,7 +29,6 @@
 #include <rte_ether.h>
 #include <rte_ethdev_driver.h>
 #include <rte_ethdev_pci.h>
-#include <rte_malloc.h>
 #include <rte_random.h>
 #include <rte_dev.h>
 #include <rte_kvargs.h>
@@ -39,8 +38,6 @@
 #include "t4_msg.h"
 #include "cxgbe.h"
 
-#define CXGBE_DEVARG_KEEP_OVLAN "keep_ovlan"
-
 /*
  * Response queue handler for the FW event queue.
  */
@@ -405,7 +402,7 @@ check_devargs_handler(__rte_unused const char *key, const char *value,
        return 0;
 }
 
-static int cxgbe_get_devargs(struct rte_devargs *devargs, const char *key)
+int cxgbe_get_devargs(struct rte_devargs *devargs, const char *key)
 {
        struct rte_kvargs *kvlist;
 
@@ -943,6 +940,18 @@ void t4_os_portmod_changed(const struct adapter *adap, int port_id)
                         pi->port_id, pi->mod_type);
 }
 
+inline bool force_linkup(struct adapter *adap)
+{
+       struct rte_pci_device *pdev = adap->pdev;
+
+       if (is_pf4(adap))
+               return false;   /* force_linkup not required for pf driver*/
+       if (!cxgbe_get_devargs(pdev->device.devargs,
+                              CXGBE_DEVARG_FORCE_LINK_UP))
+               return false;
+       return true;
+}
+
 /**
  * link_start - enable a port
  * @dev: the port to enable
@@ -988,6 +997,9 @@ int link_start(struct port_info *pi)
                ret = t4_enable_vi_params(adapter, adapter->mbox, pi->viid,
                                          true, true, false);
        }
+
+       if (ret == 0 && force_linkup(adapter))
+               pi->eth_dev->data->dev_link.link_status = ETH_LINK_UP;
        return ret;
 }
 
@@ -1436,6 +1448,11 @@ allocate_mac:
                        err = -1;
                        goto out_free;
                }
+
+               if (i > 0) {
+                       /* First port will be notified by upper layer */
+                       rte_eth_dev_probing_finish(eth_dev);
+               }
        }
 
        if (adapter->flags & FW_OK) {