common/mlx5: get PCI device address from any bus
[dpdk.git] / drivers / net / mlx5 / mlx5.c
index b5c05b1..d9c90d5 100644 (file)
@@ -217,7 +217,8 @@ static const struct mlx5_indexed_pool_config mlx5_ipool_cfg[] = {
                .grow_trunk = 3,
                .grow_shift = 2,
                .need_lock = 1,
-               .release_mem_en = 1,
+               .release_mem_en = 0,
+               .per_core_cache = (1 << 16),
                .malloc = mlx5_malloc,
                .free = mlx5_free,
                .type = "mlx5_tag_ipool",
@@ -376,7 +377,7 @@ static const struct mlx5_indexed_pool_config mlx5_ipool_cfg[] = {
 #define MLX5_FLOW_MIN_ID_POOL_SIZE 512
 #define MLX5_ID_GENERATION_ARRAY_FACTOR 16
 
-#define MLX5_FLOW_TABLE_HLIST_ARRAY_SIZE 4096
+#define MLX5_FLOW_TABLE_HLIST_ARRAY_SIZE 1024
 
 /**
  * Decide whether representor ID is a HPF(host PF) port on BF2.
@@ -797,11 +798,14 @@ mlx5_flow_ipool_create(struct mlx5_dev_ctx_shared *sh,
                if (config->reclaim_mode) {
                        cfg.release_mem_en = 1;
                        cfg.per_core_cache = 0;
+               } else {
+                       cfg.release_mem_en = 0;
                }
                sh->ipool[i] = mlx5_ipool_create(&cfg);
        }
 }
 
+
 /**
  * Release the flow resources' indexed mempool.
  *
@@ -815,6 +819,9 @@ mlx5_flow_ipool_destroy(struct mlx5_dev_ctx_shared *sh)
 
        for (i = 0; i < MLX5_IPOOL_MAX; ++i)
                mlx5_ipool_destroy(sh->ipool[i]);
+       for (i = 0; i < MLX5_MAX_MODIFY_NUM; ++i)
+               if (sh->mdh_ipools[i])
+                       mlx5_ipool_destroy(sh->mdh_ipools[i]);
 }
 
 /*
@@ -1125,6 +1132,7 @@ mlx5_alloc_shared_dev_ctx(const struct mlx5_dev_spawn_data *spawn,
        }
        sh->refcnt = 1;
        sh->max_port = spawn->max_port;
+       sh->reclaim_mode = config->reclaim_mode;
        strncpy(sh->ibdev_name, mlx5_os_get_ctx_device_name(sh->ctx),
                sizeof(sh->ibdev_name) - 1);
        strncpy(sh->ibdev_path, mlx5_os_get_ctx_device_path(sh->ctx),
@@ -1359,20 +1367,22 @@ mlx5_alloc_table_hash_list(struct mlx5_priv *priv __rte_unused)
        /* Tables are only used in DV and DR modes. */
 #if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H)
        struct mlx5_dev_ctx_shared *sh = priv->sh;
-       char s[MLX5_HLIST_NAMESIZE];
+       char s[MLX5_NAME_SIZE];
 
        MLX5_ASSERT(sh);
        snprintf(s, sizeof(s), "%s_flow_table", priv->sh->ibdev_name);
        sh->flow_tbls = mlx5_hlist_create(s, MLX5_FLOW_TABLE_HLIST_ARRAY_SIZE,
-                                         0, 0, flow_dv_tbl_create_cb,
+                                         false, true, sh,
+                                         flow_dv_tbl_create_cb,
                                          flow_dv_tbl_match_cb,
-                                         flow_dv_tbl_remove_cb);
+                                         flow_dv_tbl_remove_cb,
+                                         flow_dv_tbl_clone_cb,
+                                         flow_dv_tbl_clone_free_cb);
        if (!sh->flow_tbls) {
                DRV_LOG(ERR, "flow tables with hash creation failed.");
                err = ENOMEM;
                return err;
        }
-       sh->flow_tbls->ctx = sh;
 #ifndef HAVE_MLX5DV_DR
        struct rte_flow_error error;
        struct rte_eth_dev *dev = &rte_eth_devices[priv->dev_data->port_id];
@@ -1612,7 +1622,8 @@ mlx5_dev_close(struct rte_eth_dev *dev)
        if (ret)
                DRV_LOG(WARNING, "port %u some flows still remain",
                        dev->data->port_id);
-       mlx5_cache_list_destroy(&priv->hrxqs);
+       if (priv->hrxqs)
+               mlx5_list_destroy(priv->hrxqs);
        /*
         * Free the shared context in last turn, because the cleanup
         * routines above may use some shared fields, like
@@ -2435,7 +2446,7 @@ static const struct rte_pci_id mlx5_pci_id_map[] = {
 };
 
 static struct mlx5_pci_driver mlx5_driver = {
-       .driver_class = MLX5_CLASS_NET,
+       .driver_class = MLX5_CLASS_ETH,
        .pci_driver = {
                .driver = {
                        .name = MLX5_PCI_DRIVER_NAME,