drivers: update registration macro usage
[dpdk.git] / drivers / net / mlx5 / mlx5.c
index d08d4ac..358e9b4 100644 (file)
 #include "mlx5_autoconf.h"
 #include "mlx5_defs.h"
 
+/* Device parameter to enable RX completion queue compression. */
+#define MLX5_RXQ_CQE_COMP_EN "rxq_cqe_comp_en"
+
+/* Device parameter to configure inline send. */
+#define MLX5_TXQ_INLINE "txq_inline"
+
+/*
+ * Device parameter to configure the number of TX queues threshold for
+ * enabling inline send.
+ */
+#define MLX5_TXQS_MIN_INLINE "txqs_min_inline"
+
+/* Device parameter to enable multi-packet send WQEs. */
+#define MLX5_TXQ_MPW_EN "txq_mpw_en"
+
 /**
  * Retrieve integer value from environment variable.
  *
@@ -256,12 +271,27 @@ static int
 mlx5_args_check(const char *key, const char *val, void *opaque)
 {
        struct priv *priv = opaque;
+       unsigned long tmp;
 
-       /* No parameters are expected at the moment. */
-       (void)priv;
-       (void)val;
-       WARN("%s: unknown parameter", key);
-       return -EINVAL;
+       errno = 0;
+       tmp = strtoul(val, NULL, 0);
+       if (errno) {
+               WARN("%s: \"%s\" is not a valid integer", key, val);
+               return errno;
+       }
+       if (strcmp(MLX5_RXQ_CQE_COMP_EN, key) == 0) {
+               priv->cqe_comp = !!tmp;
+       } else if (strcmp(MLX5_TXQ_INLINE, key) == 0) {
+               priv->txq_inline = tmp;
+       } else if (strcmp(MLX5_TXQS_MIN_INLINE, key) == 0) {
+               priv->txqs_inline = tmp;
+       } else if (strcmp(MLX5_TXQ_MPW_EN, key) == 0) {
+               priv->mps = !!tmp;
+       } else {
+               WARN("%s: unknown parameter", key);
+               return -EINVAL;
+       }
+       return 0;
 }
 
 /**
@@ -279,6 +309,10 @@ static int
 mlx5_args(struct priv *priv, struct rte_devargs *devargs)
 {
        const char **params = (const char *[]){
+               MLX5_RXQ_CQE_COMP_EN,
+               MLX5_TXQ_INLINE,
+               MLX5_TXQS_MIN_INLINE,
+               MLX5_TXQ_MPW_EN,
                NULL,
        };
        struct rte_kvargs *kvlist;
@@ -475,6 +509,8 @@ mlx5_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
                priv->port = port;
                priv->pd = pd;
                priv->mtu = ETHER_MTU;
+               priv->mps = mps; /* Enable MPW by default if supported. */
+               priv->cqe_comp = 1; /* Enable compression by default. */
                err = mlx5_args(priv, pci_dev->devargs);
                if (err) {
                        ERROR("failed to process device arguments: %s",
@@ -522,7 +558,12 @@ mlx5_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 
                priv_get_num_vfs(priv, &num_vfs);
                priv->sriov = (num_vfs || sriov);
-               priv->mps = mps;
+               if (priv->mps && !mps) {
+                       ERROR("multi-packet send not supported on this device"
+                             " (" MLX5_TXQ_MPW_EN ")");
+                       err = ENOTSUP;
+                       goto port_error;
+               }
                /* Allocate and register default RSS hash keys. */
                priv->rss_conf = rte_calloc(__func__, hash_rxq_init_n,
                                            sizeof((*priv->rss_conf)[0]), 0);
@@ -721,4 +762,5 @@ static struct rte_driver rte_mlx5_driver = {
        .init = rte_mlx5_pmd_init,
 };
 
-PMD_REGISTER_DRIVER(rte_mlx5_driver)
+PMD_REGISTER_DRIVER(rte_mlx5_driveri, mlx5)
+DRIVER_REGISTER_PCI_TABLE(mlx5, mlx5_pci_id_map);