vdpa/mlx5: add basic steering configurations
[dpdk.git] / drivers / vdpa / mlx5 / mlx5_vdpa.c
index 00d3a19..28b94a3 100644 (file)
@@ -1,19 +1,10 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2019 Mellanox Technologies, Ltd
  */
-#include <linux/virtio_net.h>
-
 #include <rte_malloc.h>
 #include <rte_log.h>
 #include <rte_errno.h>
 #include <rte_bus_pci.h>
-#ifdef PEDANTIC
-#pragma GCC diagnostic ignored "-Wpedantic"
-#endif
-#include <rte_vdpa.h>
-#ifdef PEDANTIC
-#pragma GCC diagnostic error "-Wpedantic"
-#endif
 
 #include <mlx5_glue.h>
 #include <mlx5_common.h>
 #include <mlx5_prm.h>
 
 #include "mlx5_vdpa_utils.h"
+#include "mlx5_vdpa.h"
 
 
-struct mlx5_vdpa_priv {
-       TAILQ_ENTRY(mlx5_vdpa_priv) next;
-       int id; /* vDPA device id. */
-       struct ibv_context *ctx; /* Device context. */
-       struct rte_vdpa_dev_addr dev_addr;
-       struct mlx5_hca_vdpa_attr caps;
-};
-
-#ifndef VIRTIO_F_ORDER_PLATFORM
-#define VIRTIO_F_ORDER_PLATFORM 36
-#endif
-
-#ifndef VIRTIO_F_RING_PACKED
-#define VIRTIO_F_RING_PACKED 34
-#endif
-
 #define MLX5_VDPA_DEFAULT_FEATURES ((1ULL << VHOST_USER_F_PROTOCOL_FEATURES) | \
                            (1ULL << VIRTIO_F_ANY_LAYOUT) | \
                            (1ULL << VIRTIO_NET_F_MQ) | \
@@ -233,6 +209,7 @@ mlx5_vdpa_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
                        goto error;
                }
                priv->caps = attr.vdpa;
+               priv->log_max_rqt_size = attr.log_max_rqt_size;
        }
        priv->ctx = ctx;
        priv->dev_addr.pci_addr = pci_dev->addr;
@@ -243,6 +220,8 @@ mlx5_vdpa_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
                rte_errno = rte_errno ? rte_errno : EINVAL;
                goto error;
        }
+       SLIST_INIT(&priv->mr_list);
+       SLIST_INIT(&priv->virtq_list);
        pthread_mutex_lock(&priv_list_lock);
        TAILQ_INSERT_TAIL(&priv_list, priv, next);
        pthread_mutex_unlock(&priv_list_lock);