#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
-#include <rte_memory.h>
/*
* Not needed by this file; included to work around the lack of off_t
* definition for mlx5dv.h with unpatched rdma-core versions.
#include <sys/types.h>
#include "mlx5_glue.h"
-#include "../mlx5_malloc.h"
static int
mlx5_glue_fork_init(void)
res = ibv_destroy_flow_action(attr->action);
break;
}
- mlx5_free(action);
+ free(action);
return res;
#endif
#else
#endif
}
+static int
+mlx5_glue_dr_sync_domain(void *domain, uint32_t flags)
+{
+#ifdef HAVE_MLX5DV_DR
+ return mlx5dv_dr_domain_sync(domain, flags);
+#else
+ (void)domain;
+ (void)flags;
+ errno = ENOTSUP;
+ return errno;
+#endif
+}
+
static struct ibv_cq_ex *
mlx5_glue_dv_create_cq(struct ibv_context *context,
struct ibv_cq_init_attr_ex *cq_attr,
struct mlx5dv_flow_action_attr *action;
(void)offset;
- action = mlx5_malloc(0, sizeof(*action), 0, SOCKET_ID_ANY);
+ action = malloc(sizeof(*action));
if (!action)
return NULL;
action->type = MLX5DV_FLOW_ACTION_COUNTERS_DEVX;
#else
struct mlx5dv_flow_action_attr *action;
- action = mlx5_malloc(0, sizeof(*action), 0, SOCKET_ID_ANY);
+ action = malloc(sizeof(*action));
if (!action)
return NULL;
action->type = MLX5DV_FLOW_ACTION_DEST_IBV_QP;
(void)domain;
(void)flags;
- action = mlx5_malloc(0, sizeof(*action), 0, SOCKET_ID_ANY);
+ action = malloc(sizeof(*action));
if (!action)
return NULL;
action->type = MLX5DV_FLOW_ACTION_IBV_FLOW_ACTION;
(void)flags;
struct mlx5dv_flow_action_attr *action;
- action = mlx5_malloc(0, sizeof(*action), 0, SOCKET_ID_ANY);
+ action = malloc(sizeof(*action));
if (!action)
return NULL;
action->type = MLX5DV_FLOW_ACTION_IBV_FLOW_ACTION;
#else /* HAVE_MLX5DV_DR */
struct mlx5dv_flow_action_attr *action;
- action = mlx5_malloc(0, sizeof(*action), 0, SOCKET_ID_ANY);
+ action = malloc(sizeof(*action));
if (!action)
return NULL;
action->type = MLX5DV_FLOW_ACTION_TAG;
#endif
}
+static void *
+mlx5_glue_dv_create_flow_action_aso(struct mlx5dv_dr_domain *domain,
+ void *aso_obj,
+ uint32_t offset,
+ uint32_t flags,
+ uint8_t return_reg_c)
+{
+#if defined(HAVE_MLX5DV_DR) && defined(HAVE_MLX5_DR_CREATE_ACTION_ASO)
+ return mlx5dv_dr_action_create_aso(domain, aso_obj, offset,
+ flags, return_reg_c);
+#else
+ (void)domain;
+ (void)aso_obj;
+ (void)offset;
+ (void)flags;
+ (void)return_reg_c;
+ errno = ENOTSUP;
+ return NULL;
+#endif
+}
+
static void *
mlx5_glue_dr_create_flow_action_default_miss(void)
{
#endif
}
+static int
+mlx5_glue_devx_wq_query(struct ibv_wq *wq, const void *in, size_t inlen,
+ void *out, size_t outlen)
+{
+#ifdef HAVE_IBV_DEVX_QP
+ return mlx5dv_devx_wq_query(wq, in, inlen, out, outlen);
+#else
+ (void)wq;
+ (void)in;
+ (void)inlen;
+ (void)out;
+ (void)outlen;
+ errno = ENOTSUP;
+ return errno;
+#endif
+}
+
static int
mlx5_glue_devx_port_query(struct ibv_context *ctx,
uint32_t port_num,
#endif
}
+static int
+mlx5_glue_dr_dump_single_rule(FILE *file, void *rule)
+{
+#ifdef HAVE_MLX5_DR_FLOW_DUMP_RULE
+ return mlx5dv_dump_dr_rule(file, rule);
+#else
+ RTE_SET_USED(file);
+ RTE_SET_USED(rule);
+ return -ENOTSUP;
+#endif
+}
+
static int
mlx5_glue_dr_dump_domain(FILE *file, void *domain)
{
#endif
}
+static void *
+mlx5_glue_dr_create_flow_action_sampler
+ (struct mlx5dv_dr_flow_sampler_attr *attr)
+{
+#ifdef HAVE_MLX5_DR_CREATE_ACTION_FLOW_SAMPLE
+ return mlx5dv_dr_action_create_flow_sampler(attr);
+#else
+ (void)attr;
+ errno = ENOTSUP;
+ return NULL;
+#endif
+}
+
+static void *
+mlx5_glue_dr_action_create_dest_array
+ (void *domain,
+ size_t num_dest,
+ struct mlx5dv_dr_action_dest_attr *dests[])
+{
+#ifdef HAVE_MLX5_DR_CREATE_ACTION_DEST_ARRAY
+ return mlx5dv_dr_action_create_dest_array
+ (domain,
+ num_dest,
+ dests);
+#else
+ (void)domain;
+ (void)num_dest;
+ (void)dests;
+ errno = ENOTSUP;
+ return NULL;
+#endif
+}
+
static int
mlx5_glue_devx_query_eqn(struct ibv_context *ctx, uint32_t cpus,
uint32_t *eqn)
.dr_destroy_flow_tbl = mlx5_glue_dr_destroy_flow_tbl,
.dr_create_domain = mlx5_glue_dr_create_domain,
.dr_destroy_domain = mlx5_glue_dr_destroy_domain,
+ .dr_sync_domain = mlx5_glue_dr_sync_domain,
.dv_create_cq = mlx5_glue_dv_create_cq,
.dv_create_wq = mlx5_glue_dv_create_wq,
.dv_query_device = mlx5_glue_dv_query_device,
.dv_create_flow_action_tag = mlx5_glue_dv_create_flow_action_tag,
.dv_create_flow_action_meter = mlx5_glue_dv_create_flow_action_meter,
.dv_modify_flow_action_meter = mlx5_glue_dv_modify_flow_action_meter,
+ .dv_create_flow_action_aso = mlx5_glue_dv_create_flow_action_aso,
.dr_create_flow_action_default_miss =
mlx5_glue_dr_create_flow_action_default_miss,
.dv_destroy_flow = mlx5_glue_dv_destroy_flow,
.devx_umem_reg = mlx5_glue_devx_umem_reg,
.devx_umem_dereg = mlx5_glue_devx_umem_dereg,
.devx_qp_query = mlx5_glue_devx_qp_query,
+ .devx_wq_query = mlx5_glue_devx_wq_query,
.devx_port_query = mlx5_glue_devx_port_query,
.dr_dump_domain = mlx5_glue_dr_dump_domain,
+ .dr_dump_rule = mlx5_glue_dr_dump_single_rule,
.dr_reclaim_domain_memory = mlx5_glue_dr_reclaim_domain_memory,
+ .dr_create_flow_action_sampler =
+ mlx5_glue_dr_create_flow_action_sampler,
+ .dr_create_flow_action_dest_array =
+ mlx5_glue_dr_action_create_dest_array,
.devx_query_eqn = mlx5_glue_devx_query_eqn,
.devx_create_event_channel = mlx5_glue_devx_create_event_channel,
.devx_destroy_event_channel = mlx5_glue_devx_destroy_event_channel,