net/octeontx: support fast mbuf free
[dpdk.git] / drivers / common / mlx5 / mlx5_glue.c
index e4eabdb..428de0f 100644 (file)
@@ -14,8 +14,6 @@
  */
 #include <sys/types.h>
 
-#include <rte_config.h>
-
 #include "mlx5_glue.h"
 
 static int
@@ -1137,8 +1135,55 @@ mlx5_glue_devx_get_event(struct mlx5dv_devx_event_channel *eventc,
 #endif
 }
 
-alignas(RTE_CACHE_LINE_SIZE)
-const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue){
+static struct mlx5dv_devx_uar *
+mlx5_glue_devx_alloc_uar(struct ibv_context *context, uint32_t flags)
+{
+#ifdef HAVE_IBV_DEVX_OBJ
+       return mlx5dv_devx_alloc_uar(context, flags);
+#else
+       (void)context;
+       (void)flags;
+       errno = ENOTSUP;
+       return NULL;
+#endif
+}
+
+static void
+mlx5_glue_devx_free_uar(struct mlx5dv_devx_uar *devx_uar)
+{
+#ifdef HAVE_IBV_DEVX_OBJ
+       mlx5dv_devx_free_uar(devx_uar);
+#else
+       (void)devx_uar;
+#endif
+}
+
+static struct mlx5dv_var *
+mlx5_glue_dv_alloc_var(struct ibv_context *context, uint32_t flags)
+{
+#ifdef HAVE_IBV_VAR
+       return mlx5dv_alloc_var(context, flags);
+#else
+       (void)context;
+       (void)flags;
+       errno = ENOTSUP;
+       return NULL;
+#endif
+}
+
+static void
+mlx5_glue_dv_free_var(struct mlx5dv_var *var)
+{
+#ifdef HAVE_IBV_VAR
+       mlx5dv_free_var(var);
+#else
+       (void)var;
+       errno = ENOTSUP;
+#endif
+}
+
+__rte_cache_aligned
+const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue) {
        .version = MLX5_GLUE_VERSION,
        .fork_init = mlx5_glue_fork_init,
        .alloc_pd = mlx5_glue_alloc_pd,
@@ -1242,4 +1287,8 @@ const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue){
        .devx_subscribe_devx_event = mlx5_glue_devx_subscribe_devx_event,
        .devx_subscribe_devx_event_fd = mlx5_glue_devx_subscribe_devx_event_fd,
        .devx_get_event = mlx5_glue_devx_get_event,
+       .devx_alloc_uar = mlx5_glue_devx_alloc_uar,
+       .devx_free_uar = mlx5_glue_devx_free_uar,
+       .dv_alloc_var = mlx5_glue_dv_alloc_var,
+       .dv_free_var = mlx5_glue_dv_free_var,
 };