net/mlx5: add meter action creation to the glue

This commit add the meter action creation to the glue code.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
This commit is contained in:
Suanming Mou 2019-11-08 05:49:15 +02:00 committed by Ferruh Yigit
parent 3f373f3523
commit 1b346cc63d
2 changed files with 39 additions and 0 deletions

View File

@ -765,6 +765,34 @@ mlx5_glue_dv_create_flow_action_tag(uint32_t tag)
return NULL;
}
static void *
mlx5_glue_dv_create_flow_action_meter(struct mlx5dv_dr_flow_meter_attr *attr)
{
#if defined(HAVE_MLX5DV_DR) && defined(HAVE_MLX5_DR_CREATE_ACTION_FLOW_METER)
return mlx5dv_dr_action_create_flow_meter(attr);
#else
(void)attr;
errno = ENOTSUP;
return NULL;
#endif
}
static int
mlx5_glue_dv_modify_flow_action_meter(void *action,
struct mlx5dv_dr_flow_meter_attr *attr,
uint64_t modify_bits)
{
#if defined(HAVE_MLX5DV_DR) && defined(HAVE_MLX5_DR_CREATE_ACTION_FLOW_METER)
return mlx5dv_dr_action_modify_flow_meter(action, attr, modify_bits);
#else
(void)action;
(void)attr;
(void)modify_bits;
errno = ENOTSUP;
return errno;
#endif
}
static int
mlx5_glue_dv_destroy_flow(void *flow_id)
{
@ -1084,6 +1112,8 @@ const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue){
.dv_create_flow_action_packet_reformat =
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,
.dv_destroy_flow = mlx5_glue_dv_destroy_flow,
.dv_destroy_flow_matcher = mlx5_glue_dv_destroy_flow_matcher,
.dv_open_device = mlx5_glue_dv_open_device,

View File

@ -52,6 +52,7 @@ struct mlx5dv_flow_matcher;
struct mlx5dv_flow_matcher_attr;
struct mlx5dv_flow_action_attr;
struct mlx5dv_flow_match_parameters;
struct mlx5dv_dr_flow_meter_attr;
struct ibv_flow_action;
enum mlx5dv_flow_action_packet_reformat_type { packet_reformat_type = 0, };
enum mlx5dv_flow_table_type { flow_table_type = 0, };
@ -80,6 +81,10 @@ struct mlx5dv_dr_domain;
struct mlx5dv_devx_port;
#endif
#ifndef HAVE_MLX5_DR_CREATE_ACTION_FLOW_METER
struct mlx5dv_dr_flow_meter_attr;
#endif
/* LIB_GLUE_VERSION must be updated every time this structure is modified. */
struct mlx5_glue {
const char *version;
@ -209,6 +214,10 @@ struct mlx5_glue {
struct mlx5dv_dr_domain *domain,
uint32_t flags, size_t data_sz, void *data);
void *(*dv_create_flow_action_tag)(uint32_t tag);
void *(*dv_create_flow_action_meter)
(struct mlx5dv_dr_flow_meter_attr *attr);
int (*dv_modify_flow_action_meter)(void *action,
struct mlx5dv_dr_flow_meter_attr *attr, uint64_t modify_bits);
int (*dv_destroy_flow)(void *flow);
int (*dv_destroy_flow_matcher)(void *matcher);
struct ibv_context *(*dv_open_device)(struct ibv_device *device);