net/virtio: fix outdated comment
[dpdk.git] / drivers / net / mlx5 / mlx5.c
index b4ec6cb..efdd53c 100644 (file)
@@ -29,7 +29,6 @@
 #include <rte_pci.h>
 #include <rte_bus_pci.h>
 #include <rte_common.h>
-#include <rte_config.h>
 #include <rte_kvargs.h>
 #include <rte_rwlock.h>
 #include <rte_spinlock.h>
 /* 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)
@@ -386,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);
@@ -1235,9 +1242,20 @@ mlx5_dev_close(struct rte_eth_dev *dev)
        /* In case mlx5_dev_stop() has not been called. */
        mlx5_dev_interrupt_handler_uninstall(dev);
        mlx5_dev_interrupt_handler_devx_uninstall(dev);
+       /*
+        * If default mreg copy action is removed at the stop stage,
+        * the search will return none and nothing will be done anymore.
+        */
+       mlx5_flow_stop_default(dev);
        mlx5_traffic_disable(dev);
-       mlx5_flow_flush(dev, NULL);
+       /*
+        * If all the flows are already flushed in the device stop stage,
+        * then this will return directly without any action.
+        */
+       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;
@@ -1581,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;
@@ -1633,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;
@@ -1725,7 +1746,7 @@ out:
  *   key is specified in devargs
  * - if DevX is enabled the inline mode is queried from the
  *   device (HCA attributes and NIC vport context if needed).
- * - otherwise L2 mode (18 bytes) is assumed for ConnectX-4/4LX
+ * - otherwise L2 mode (18 bytes) is assumed for ConnectX-4/4 Lx
  *   and none (0 bytes) for other NICs
  *
  * @param spawn
@@ -2760,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) {
@@ -3343,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) {
@@ -3530,6 +3557,10 @@ static const struct rte_pci_id mlx5_pci_id_map[] = {
                RTE_PCI_DEVICE(PCI_VENDOR_ID_MELLANOX,
                                PCI_DEVICE_ID_MELLANOX_CONNECTX6DXVF)
        },
+       {
+               RTE_PCI_DEVICE(PCI_VENDOR_ID_MELLANOX,
+                               PCI_DEVICE_ID_MELLANOX_CONNECTX6DXBF)
+       },
        {
                .vendor_id = 0
        }