New upstream version 17.11.5
[deb_dpdk.git] / drivers / net / mlx5 / mlx5.c
index 10ce335..e117ec8 100644 (file)
  */
 #define MLX5_TXQS_MIN_INLINE "txqs_min_inline"
 
+/*
+ * Device parameter to configure the number of TX queues threshold for
+ * enabling vectorized Tx.
+ */
+#define MLX5_TXQS_MAX_VEC "txqs_max_vec"
+
 /* Device parameter to enable multi-packet send WQEs. */
 #define MLX5_TXQ_MPW_EN "txq_mpw_en"
 
@@ -112,6 +118,7 @@ struct mlx5_args {
        int cqe_comp;
        int txq_inline;
        int txqs_inline;
+       int txqs_vec;
        int mps;
        int mpw_hdr_dseg;
        int inline_max_packet_sz;
@@ -236,6 +243,7 @@ mlx5_dev_close(struct rte_eth_dev *dev)
                priv->txqs_n = 0;
                priv->txqs = NULL;
        }
+       mlx5_mr_deregister_memseg(dev);
        if (priv->pd != NULL) {
                assert(priv->ctx != NULL);
                claim_zero(ibv_dealloc_pd(priv->pd));
@@ -276,10 +284,6 @@ mlx5_dev_close(struct rte_eth_dev *dev)
        if (ret)
                DRV_LOG(WARNING, "port %u some flows still remain",
                        dev->data->port_id);
-       ret = mlx5_mr_verify(dev);
-       if (ret)
-               DRV_LOG(WARNING, "port %u some memory region still remain",
-                       dev->data->port_id);
        memset(priv, 0, sizeof(*priv));
 }
 
@@ -345,6 +349,10 @@ const struct eth_dev_ops mlx5_dev_ops_isolate = {
        .dev_set_link_down = mlx5_set_link_down,
        .dev_set_link_up = mlx5_set_link_up,
        .dev_close = mlx5_dev_close,
+       .promiscuous_enable = mlx5_promiscuous_enable,
+       .promiscuous_disable = mlx5_promiscuous_disable,
+       .allmulticast_enable = mlx5_allmulticast_enable,
+       .allmulticast_disable = mlx5_allmulticast_disable,
        .link_update = mlx5_link_update,
        .stats_get = mlx5_stats_get,
        .stats_reset = mlx5_stats_reset,
@@ -438,6 +446,8 @@ mlx5_args_check(const char *key, const char *val, void *opaque)
                args->txq_inline = tmp;
        } else if (strcmp(MLX5_TXQS_MIN_INLINE, key) == 0) {
                args->txqs_inline = tmp;
+       } else if (strcmp(MLX5_TXQS_MAX_VEC, key) == 0) {
+               args->txqs_vec = tmp;
        } else if (strcmp(MLX5_TXQ_MPW_EN, key) == 0) {
                args->mps = !!tmp;
        } else if (strcmp(MLX5_TXQ_MPW_HDR_DSEG_EN, key) == 0) {
@@ -476,6 +486,7 @@ mlx5_args(struct mlx5_args *args, struct rte_devargs *devargs)
                MLX5_RXQ_CQE_COMP_EN,
                MLX5_TXQ_INLINE,
                MLX5_TXQS_MIN_INLINE,
+               MLX5_TXQS_MAX_VEC,
                MLX5_TXQ_MPW_EN,
                MLX5_TXQ_MPW_HDR_DSEG_EN,
                MLX5_TXQ_MAX_INLINE_LEN,
@@ -636,8 +647,17 @@ mlx5_args_assign(struct priv *priv, struct mlx5_args *args)
                priv->txq_inline = args->txq_inline;
        if (args->txqs_inline != MLX5_ARG_UNSET)
                priv->txqs_inline = args->txqs_inline;
-       if (args->mps != MLX5_ARG_UNSET)
+       if (args->txqs_vec != MLX5_ARG_UNSET)
+               priv->txqs_vec = args->txqs_vec;
+       if (args->mps != MLX5_ARG_UNSET) {
                priv->mps = args->mps ? priv->mps : 0;
+       } else if (priv->mps == MLX5_MPW) {
+               /*
+                * MPW is disabled by default, while the Enhanced MPW is enabled
+                * by default.
+                */
+               priv->mps = MLX5_MPW_DISABLED;
+       }
        if (args->mpw_hdr_dseg != MLX5_ARG_UNSET)
                priv->mpw_hdr_dseg = args->mpw_hdr_dseg;
        if (args->inline_max_packet_sz != MLX5_ARG_UNSET)
@@ -676,11 +696,12 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
        unsigned int mps;
        unsigned int cqe_comp;
        unsigned int tunnel_en = 0;
+       unsigned int txqs_vec = MLX5_VPMD_MAX_TXQS;
        int idx;
        int i;
        struct mlx5dv_context attrs_out;
 #ifdef HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT
-       struct ibv_counter_set_description cs_desc;
+       struct ibv_counter_set_description cs_desc = { .counter_type = 0 };
 #endif
 
        assert(pci_drv == &mlx5_driver);
@@ -722,8 +743,6 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
                        continue;
                switch (pci_dev->id.device_id) {
                case PCI_DEVICE_ID_MELLANOX_CONNECTX4:
-                       tunnel_en = 1;
-                       break;
                case PCI_DEVICE_ID_MELLANOX_CONNECTX4LX:
                case PCI_DEVICE_ID_MELLANOX_CONNECTX5:
                case PCI_DEVICE_ID_MELLANOX_CONNECTX5VF:
@@ -731,6 +750,10 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
                case PCI_DEVICE_ID_MELLANOX_CONNECTX5EXVF:
                        tunnel_en = 1;
                        break;
+               case PCI_DEVICE_ID_MELLANOX_CONNECTX5BF:
+                       txqs_vec = MLX5_VPMD_MAX_TXQS_BLUEFIELD;
+                       tunnel_en = 1;
+                       break;
                default:
                        break;
                }
@@ -801,6 +824,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
                        .cqe_comp = MLX5_ARG_UNSET,
                        .txq_inline = MLX5_ARG_UNSET,
                        .txqs_inline = MLX5_ARG_UNSET,
+                       .txqs_vec = MLX5_ARG_UNSET,
                        .mps = MLX5_ARG_UNSET,
                        .mpw_hdr_dseg = MLX5_ARG_UNSET,
                        .inline_max_packet_sz = MLX5_ARG_UNSET,
@@ -904,6 +928,7 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
                /* Enable vector by default if supported. */
                priv->tx_vec_en = 1;
                priv->rx_vec_en = 1;
+               priv->txqs_vec = txqs_vec;
                err = mlx5_args(&args, pci_dev->device.devargs);
                if (err) {
                        DRV_LOG(ERR, "failed to process device arguments: %s",
@@ -1149,6 +1174,10 @@ static const struct rte_pci_id mlx5_pci_id_map[] = {
                RTE_PCI_DEVICE(PCI_VENDOR_ID_MELLANOX,
                               PCI_DEVICE_ID_MELLANOX_CONNECTX5EXVF)
        },
+       {
+               RTE_PCI_DEVICE(PCI_VENDOR_ID_MELLANOX,
+                              PCI_DEVICE_ID_MELLANOX_CONNECTX5BF)
+       },
        {
                .vendor_id = 0
        }