net/hns3: add RSS hash offload to capabilities
[dpdk.git] / drivers / net / mlx5 / mlx5.c
index 0613f70..efdd53c 100644 (file)
 /* Configure timeout of LRO session (in microseconds). */
 #define MLX5_LRO_TIMEOUT_USEC "lro_timeout_usec"
 
+/*
+ * Device parameter to configure the total data buffer size for a single
+ * hairpin queue (logarithm value).
+ */
+#define MLX5_HP_BUF_SIZE "hp_buf_log_sz"
+
 #ifndef HAVE_IBV_MLX5_MOD_MPW
 #define MLX5DV_CONTEXT_FLAGS_MPW_ALLOWED (1 << 2)
 #define MLX5DV_CONTEXT_FLAGS_ENHANCED_MPW (1 << 3)
@@ -385,9 +391,11 @@ mlx5_flow_counters_mng_close(struct mlx5_ibv_shared *sh)
                                        claim_zero
                                        (mlx5_glue->destroy_flow_action
                                               (pool->counters_raw[j].action));
-                               if (!batch && pool->counters_raw[j].dcs)
+                               if (!batch && MLX5_GET_POOL_CNT_EXT
+                                   (pool, j)->dcs)
                                        claim_zero(mlx5_devx_cmd_destroy
-                                                 (pool->counters_raw[j].dcs));
+                                                 (MLX5_GET_POOL_CNT_EXT
+                                                 (pool, j)->dcs));
                        }
                        TAILQ_REMOVE(&sh->cmng.ccont[i].pool_list, pool,
                                     next);
@@ -1246,6 +1254,8 @@ mlx5_dev_close(struct rte_eth_dev *dev)
         */
        mlx5_flow_list_flush(dev, &priv->flows, true);
        mlx5_flow_meter_flush(dev, NULL);
+       /* Free the intermediate buffers for flow creation. */
+       mlx5_flow_free_intermediate(dev);
        /* Prevent crashes when queues are still in use. */
        dev->rx_pkt_burst = removed_rx_burst;
        dev->tx_pkt_burst = removed_tx_burst;
@@ -1589,6 +1599,8 @@ mlx5_args_check(const char *key, const char *val, void *opaque)
                config->lro.timeout = tmp;
        } else if (strcmp(MLX5_CLASS_ARG_NAME, key) == 0) {
                DRV_LOG(DEBUG, "class argument is %s.", val);
+       } else if (strcmp(MLX5_HP_BUF_SIZE, key) == 0) {
+               config->log_hp_size = tmp;
        } else {
                DRV_LOG(WARNING, "%s: unknown parameter", key);
                rte_errno = EINVAL;
@@ -1641,6 +1653,7 @@ mlx5_args(struct mlx5_dev_config *config, struct rte_devargs *devargs)
                MLX5_MAX_DUMP_FILES_NUM,
                MLX5_LRO_TIMEOUT_USEC,
                MLX5_CLASS_ARG_NAME,
+               MLX5_HP_BUF_SIZE,
                NULL,
        };
        struct rte_kvargs *kvlist;
@@ -2768,6 +2781,11 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
                        err = ENOTSUP;
                        goto error;
        }
+       /*
+        * Allocate the buffer for flow creating, just once.
+        * The allocation must be done before any flow creating.
+        */
+       mlx5_flow_alloc_intermediate(eth_dev);
        /* Query availibility of metadata reg_c's. */
        err = mlx5_flow_discover_mreg_c(eth_dev);
        if (err < 0) {
@@ -3351,6 +3369,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
                },
                .dv_esw_en = 1,
                .dv_flow_en = 1,
+               .log_hp_size = MLX5_ARG_UNSET,
        };
        /* Device specific configuration. */
        switch (pci_dev->id.device_id) {