config: gather options for dlopen mlx dependency
[dpdk.git] / drivers / net / mlx4 / mlx4.c
index d151a90..070cf71 100644 (file)
@@ -673,10 +673,22 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
                                                   &device_attr_ex);
                DEBUG("supported RSS hash fields mask: %016" PRIx64,
                      priv->hw_rss_sup);
+               priv->hw_rss_max_qps =
+                       device_attr_ex.rss_caps.max_rwq_indirection_table_size;
+               DEBUG("MAX RSS queues %d", priv->hw_rss_max_qps);
                priv->hw_fcs_strip = !!(device_attr_ex.raw_packet_caps &
                                        IBV_RAW_PACKET_CAP_SCATTER_FCS);
                DEBUG("FCS stripping toggling is %ssupported",
                      priv->hw_fcs_strip ? "" : "not ");
+               priv->tso =
+                       ((device_attr_ex.tso_caps.max_tso > 0) &&
+                        (device_attr_ex.tso_caps.supported_qpts &
+                         (1 << IBV_QPT_RAW_PACKET)));
+               if (priv->tso)
+                       priv->tso_max_payload_sz =
+                                       device_attr_ex.tso_caps.max_tso;
+               DEBUG("TSO is %ssupported",
+                     priv->tso ? "" : "not ");
                /* Configure the first MAC address by default. */
                err = mlx4_get_mac(priv, &mac.addr_bytes);
                if (err) {
@@ -722,7 +734,6 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
                eth_dev->data->mac_addrs = priv->mac;
                eth_dev->device = &pci_dev->device;
                rte_eth_copy_pci_info(eth_dev, pci_dev);
-               eth_dev->device->driver = &mlx4_driver.driver;
                /* Initialize local interrupt handle for current port. */
                priv->intr_handle = (struct rte_intr_handle){
                        .fd = -1,
@@ -770,12 +781,17 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
                continue;
 port_error:
                rte_free(priv);
+               if (eth_dev != NULL)
+                       eth_dev->data->dev_private = NULL;
                if (pd)
                        claim_zero(mlx4_glue->dealloc_pd(pd));
                if (ctx)
                        claim_zero(mlx4_glue->close_device(ctx));
-               if (eth_dev)
+               if (eth_dev != NULL) {
+                       /* mac_addrs must not be freed because part of dev_private */
+                       eth_dev->data->mac_addrs = NULL;
                        rte_eth_dev_release_port(eth_dev);
+               }
                break;
        }
        /*
@@ -822,7 +838,7 @@ static struct rte_pci_driver mlx4_driver = {
                     RTE_PCI_DRV_INTR_RMV,
 };
 
-#ifdef RTE_LIBRTE_MLX4_DLOPEN_DEPS
+#ifdef RTE_IBVERBS_LINK_DLOPEN
 
 /**
  * Suffix RTE_EAL_PMD_PATH with "-glue".
@@ -955,9 +971,7 @@ glue_error:
 /**
  * Driver initialization routine.
  */
-RTE_INIT(rte_mlx4_pmd_init);
-static void
-rte_mlx4_pmd_init(void)
+RTE_INIT(rte_mlx4_pmd_init)
 {
        /*
         * MLX4_DEVICE_FATAL_CLEANUP tells ibv_destroy functions we
@@ -972,7 +986,7 @@ rte_mlx4_pmd_init(void)
         * using this PMD, which is not supported in forked processes.
         */
        setenv("RDMAV_HUGEPAGES_SAFE", "1", 1);
-#ifdef RTE_LIBRTE_MLX4_DLOPEN_DEPS
+#ifdef RTE_IBVERBS_LINK_DLOPEN
        if (mlx4_glue_init())
                return;
        assert(mlx4_glue);