@@ -111,6 +111,12 @@ mlx5_glue_query_device_ex(struct ibv_context *context,
return ibv_query_device_ex(context, input, attr);
}
+static const char *
+mlx5_glue_get_device_name(struct ibv_device *device)
+{
+ return ibv_get_device_name(device);
+}
+
static int
mlx5_glue_query_rt_values_ex(struct ibv_context *context,
struct ibv_values_ex *values)
@@ -620,6 +626,20 @@ mlx5_glue_dv_create_qp(struct ibv_context *context,
#endif
}
+static void *
+__mlx5_glue_dv_create_flow_matcher(struct ibv_context *context,
+ struct mlx5dv_flow_matcher_attr *matcher_attr)
+{
+#ifdef HAVE_IBV_FLOW_DV_SUPPORT
+ return mlx5dv_create_flow_matcher(context, matcher_attr);
+#else
+ (void)context;
+ (void)matcher_attr;
+ errno = ENOTSUP;
+ return NULL;
+#endif
+}
+
static void *
mlx5_glue_dv_create_flow_matcher(struct ibv_context *context,
struct mlx5dv_flow_matcher_attr *matcher_attr,
@@ -633,7 +653,7 @@ mlx5_glue_dv_create_flow_matcher(struct ibv_context *context,
matcher_attr->match_mask);
#else
(void)tbl;
- return mlx5dv_create_flow_matcher(context, matcher_attr);
+ return __mlx5_glue_dv_create_flow_matcher(context, matcher_attr);
#endif
#else
(void)context;
@@ -644,6 +664,26 @@ mlx5_glue_dv_create_flow_matcher(struct ibv_context *context,
#endif
}
+static void *
+__mlx5_glue_dv_create_flow(void *matcher,
+ void *match_value,
+ size_t num_actions,
+ void *actions)
+{
+#ifdef HAVE_IBV_FLOW_DV_SUPPORT
+ return mlx5dv_create_flow(matcher,
+ match_value,
+ num_actions,
+ (struct mlx5dv_flow_action_attr *)actions);
+#else
+ (void)matcher;
+ (void)match_value;
+ (void)num_actions;
+ (void)actions;
+ return NULL;
+#endif
+}
+
static void *
mlx5_glue_dv_create_flow(void *matcher,
void *match_value,
@@ -663,8 +703,8 @@ mlx5_glue_dv_create_flow(void *matcher,
for (i = 0; i < num_actions; i++)
actions_attr[i] =
*((struct mlx5dv_flow_action_attr *)(actions[i]));
- return mlx5dv_create_flow(matcher, match_value,
- num_actions, actions_attr);
+ return __mlx5_glue_dv_create_flow(matcher, match_value,
+ num_actions, actions_attr);
#endif
#else
(void)matcher;
@@ -735,6 +775,26 @@ mlx5_glue_dv_create_flow_action_dest_devx_tir(void *tir)
#endif
}
+static void *
+__mlx5_glue_dv_create_flow_action_modify_header
+ (struct ibv_context *ctx,
+ size_t actions_sz,
+ uint64_t actions[],
+ enum mlx5dv_flow_table_type ft_type)
+{
+#ifdef HAVE_IBV_FLOW_DV_SUPPORT
+ return mlx5dv_create_flow_action_modify_header
+ (ctx, actions_sz, actions, ft_type);
+#else
+ (void)ctx;
+ (void)ft_type;
+ (void)actions_sz;
+ (void)actions;
+ errno = ENOTSUP;
+ return NULL;
+#endif
+}
+
static void *
mlx5_glue_dv_create_flow_action_modify_header
(struct ibv_context *ctx,
@@ -758,7 +818,7 @@ mlx5_glue_dv_create_flow_action_modify_header
if (!action)
return NULL;
action->type = MLX5DV_FLOW_ACTION_IBV_FLOW_ACTION;
- action->action = mlx5dv_create_flow_action_modify_header
+ action->action = __mlx5_glue_dv_create_flow_action_modify_header
(ctx, actions_sz, actions, ft_type);
return action;
#endif
@@ -774,6 +834,27 @@ mlx5_glue_dv_create_flow_action_modify_header
#endif
}
+static void *
+__mlx5_glue_dv_create_flow_action_packet_reformat
+ (struct ibv_context *ctx,
+ size_t data_sz, void *data,
+ enum mlx5dv_flow_action_packet_reformat_type reformat_type,
+ enum mlx5dv_flow_table_type ft_type)
+{
+#ifdef HAVE_IBV_FLOW_DV_SUPPORT
+ return mlx5dv_create_flow_action_packet_reformat
+ (ctx, data_sz, data, reformat_type, ft_type);
+#else
+ (void)ctx;
+ (void)reformat_type;
+ (void)ft_type;
+ (void)data_sz;
+ (void)data;
+ errno = ENOTSUP;
+ return NULL;
+#endif
+}
+
static void *
mlx5_glue_dv_create_flow_action_packet_reformat
(struct ibv_context *ctx,
@@ -798,7 +879,7 @@ mlx5_glue_dv_create_flow_action_packet_reformat
if (!action)
return NULL;
action->type = MLX5DV_FLOW_ACTION_IBV_FLOW_ACTION;
- action->action = mlx5dv_create_flow_action_packet_reformat
+ action->action = __mlx5_glue_dv_create_flow_action_packet_reformat
(ctx, data_sz, data, reformat_type, ft_type);
return action;
#endif
@@ -908,6 +989,18 @@ mlx5_glue_dv_destroy_flow(void *flow_id)
#endif
}
+static int
+__mlx5_glue_dv_destroy_flow_matcher(void *matcher)
+{
+#ifdef HAVE_IBV_FLOW_DV_SUPPORT
+ return mlx5dv_destroy_flow_matcher(matcher);
+#else
+ (void)matcher;
+ errno = ENOTSUP;
+ return errno;
+#endif
+}
+
static int
mlx5_glue_dv_destroy_flow_matcher(void *matcher)
{
@@ -915,7 +1008,7 @@ mlx5_glue_dv_destroy_flow_matcher(void *matcher)
#ifdef HAVE_MLX5DV_DR
return mlx5dv_dr_matcher_destroy(matcher);
#else
- return mlx5dv_destroy_flow_matcher(matcher);
+ return __mlx5_glue_dv_destroy_flow_matcher(matcher);
#endif
#else
(void)matcher;
@@ -1164,12 +1257,18 @@ mlx5_glue_devx_port_query(struct ibv_context *ctx,
info->vport_id = devx_port.vport;
info->query_flags |= MLX5_PORT_QUERY_VPORT;
}
+ if (devx_port.flags & MLX5DV_QUERY_PORT_ESW_OWNER_VHCA_ID) {
+ info->esw_owner_vhca_id = devx_port.esw_owner_vhca_id;
+ info->query_flags |= MLX5_PORT_QUERY_ESW_OWNER_VHCA_ID;
+ }
#else
#ifdef HAVE_MLX5DV_DR_DEVX_PORT
/* The legacy DevX port query API is implemented (prior v35). */
struct mlx5dv_devx_port devx_port = {
.comp_mask = MLX5DV_DEVX_PORT_VPORT |
- MLX5DV_DEVX_PORT_MATCH_REG_C_0
+ MLX5DV_DEVX_PORT_MATCH_REG_C_0 |
+ MLX5DV_DEVX_PORT_VPORT_VHCA_ID |
+ MLX5DV_DEVX_PORT_ESW_OWNER_VHCA_ID
};
err = mlx5dv_query_devx_port(ctx, port_num, &devx_port);
@@ -1449,6 +1548,7 @@ const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue) {
.close_device = mlx5_glue_close_device,
.query_device = mlx5_glue_query_device,
.query_device_ex = mlx5_glue_query_device_ex,
+ .get_device_name = mlx5_glue_get_device_name,
.query_rt_values_ex = mlx5_glue_query_rt_values_ex,
.query_port = mlx5_glue_query_port,
.create_comp_channel = mlx5_glue_create_comp_channel,
@@ -1507,7 +1607,9 @@ const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue) {
.dv_init_obj = mlx5_glue_dv_init_obj,
.dv_create_qp = mlx5_glue_dv_create_qp,
.dv_create_flow_matcher = mlx5_glue_dv_create_flow_matcher,
+ .dv_create_flow_matcher_root = __mlx5_glue_dv_create_flow_matcher,
.dv_create_flow = mlx5_glue_dv_create_flow,
+ .dv_create_flow_root = __mlx5_glue_dv_create_flow,
.dv_create_flow_action_counter =
mlx5_glue_dv_create_flow_action_counter,
.dv_create_flow_action_dest_ibv_qp =
@@ -1516,8 +1618,12 @@ const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue) {
mlx5_glue_dv_create_flow_action_dest_devx_tir,
.dv_create_flow_action_modify_header =
mlx5_glue_dv_create_flow_action_modify_header,
+ .dv_create_flow_action_modify_header_root =
+ __mlx5_glue_dv_create_flow_action_modify_header,
.dv_create_flow_action_packet_reformat =
mlx5_glue_dv_create_flow_action_packet_reformat,
+ .dv_create_flow_action_packet_reformat_root =
+ __mlx5_glue_dv_create_flow_action_packet_reformat,
.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,
@@ -1526,6 +1632,7 @@ const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue) {
mlx5_glue_dr_create_flow_action_default_miss,
.dv_destroy_flow = mlx5_glue_dv_destroy_flow,
.dv_destroy_flow_matcher = mlx5_glue_dv_destroy_flow_matcher,
+ .dv_destroy_flow_matcher_root = __mlx5_glue_dv_destroy_flow_matcher,
.dv_open_device = mlx5_glue_dv_open_device,
.devx_obj_create = mlx5_glue_devx_obj_create,
.devx_obj_destroy = mlx5_glue_devx_obj_destroy,
@@ -91,10 +91,12 @@ struct mlx5dv_port;
#define MLX5_PORT_QUERY_VPORT (1u << 0)
#define MLX5_PORT_QUERY_REG_C0 (1u << 1)
+#define MLX5_PORT_QUERY_ESW_OWNER_VHCA_ID (1u << 2)
struct mlx5_port_info {
uint16_t query_flags;
uint16_t vport_id; /* Associated VF vport index (if any). */
+ uint16_t esw_owner_vhca_id; /* Associated the esw_owner that this VF belongs to. */
uint32_t vport_meta_tag; /* Used for vport index match ove VF LAG. */
uint32_t vport_meta_mask; /* Used for vport index field match mask. */
};
@@ -164,6 +166,7 @@ struct mlx5_glue {
int (*query_device_ex)(struct ibv_context *context,
const struct ibv_query_device_ex_input *input,
struct ibv_device_attr_ex *attr);
+ const char *(*get_device_name)(struct ibv_device *device);
int (*query_rt_values_ex)(struct ibv_context *context,
struct ibv_values_ex *values);
int (*query_port)(struct ibv_context *context, uint8_t port_num,
@@ -268,8 +271,13 @@ struct mlx5_glue {
(struct ibv_context *context,
struct mlx5dv_flow_matcher_attr *matcher_attr,
void *tbl);
+ void *(*dv_create_flow_matcher_root)
+ (struct ibv_context *context,
+ struct mlx5dv_flow_matcher_attr *matcher_attr);
void *(*dv_create_flow)(void *matcher, void *match_value,
size_t num_actions, void *actions[]);
+ void *(*dv_create_flow_root)(void *matcher, void *match_value,
+ size_t num_actions, void *actions);
void *(*dv_create_flow_action_counter)(void *obj, uint32_t offset);
void *(*dv_create_flow_action_dest_ibv_qp)(void *qp);
void *(*dv_create_flow_action_dest_devx_tir)(void *tir);
@@ -277,12 +285,20 @@ struct mlx5_glue {
(struct ibv_context *ctx, enum mlx5dv_flow_table_type ft_type,
void *domain, uint64_t flags, size_t actions_sz,
uint64_t actions[]);
+ void *(*dv_create_flow_action_modify_header_root)
+ (struct ibv_context *ctx, size_t actions_sz, uint64_t actions[],
+ enum mlx5dv_flow_table_type ft_type);
void *(*dv_create_flow_action_packet_reformat)
(struct ibv_context *ctx,
enum mlx5dv_flow_action_packet_reformat_type reformat_type,
enum mlx5dv_flow_table_type ft_type,
struct mlx5dv_dr_domain *domain,
uint32_t flags, size_t data_sz, void *data);
+ void *(*dv_create_flow_action_packet_reformat_root)
+ (struct ibv_context *ctx,
+ size_t data_sz, void *data,
+ enum mlx5dv_flow_action_packet_reformat_type reformat_type,
+ enum mlx5dv_flow_table_type ft_type);
void *(*dv_create_flow_action_tag)(uint32_t tag);
void *(*dv_create_flow_action_meter)
(struct mlx5dv_dr_flow_meter_attr *attr);
@@ -291,6 +307,7 @@ struct mlx5_glue {
void *(*dr_create_flow_action_default_miss)(void);
int (*dv_destroy_flow)(void *flow);
int (*dv_destroy_flow_matcher)(void *matcher);
+ int (*dv_destroy_flow_matcher_root)(void *matcher);
struct ibv_context *(*dv_open_device)(struct ibv_device *device);
struct mlx5dv_var *(*dv_alloc_var)(struct ibv_context *context,
uint32_t flags);