From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yongseok Koh Subject: Re: [PATCH 1/4] net/mlx5: add flow action functions to glue Date: Tue, 2 Oct 2018 01:02:32 +0000 Message-ID: <20181002010223.GA10028@mtidpdk.mti.labs.mlnx> References: <1538059845-35896-1-git-send-email-dekelp@mellanox.com> <1538059845-35896-2-git-send-email-dekelp@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: "dev@dpdk.org" , Shahaf Shuler , Ori Kam To: Dekel Peled Return-path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0041.outbound.protection.outlook.com [104.47.1.41]) by dpdk.org (Postfix) with ESMTP id 60E1758C4 for ; Tue, 2 Oct 2018 03:02:34 +0200 (CEST) In-Reply-To: <1538059845-35896-2-git-send-email-dekelp@mellanox.com> Content-Language: en-US Content-ID: <3B002CE40B81B644A3A4784827BFC115@eurprd05.prod.outlook.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Thu, Sep 27, 2018 at 05:50:42PM +0300, Dekel Peled wrote: > This patch adds glue functions for operations: > - Create packet reformat (encap/decap) flow action. > - Destroy flow action. >=20 > Signed-off-by: Dekel Peled > --- > drivers/net/mlx5/mlx5_glue.c | 33 +++++++++++++++++++++++++++++++++ > drivers/net/mlx5/mlx5_glue.h | 7 +++++++ > 2 files changed, 40 insertions(+) >=20 > diff --git a/drivers/net/mlx5/mlx5_glue.c b/drivers/net/mlx5/mlx5_glue.c > index 48590df..caa4c34 100644 > --- a/drivers/net/mlx5/mlx5_glue.c > +++ b/drivers/net/mlx5/mlx5_glue.c > @@ -174,6 +174,12 @@ > return ibv_destroy_flow(flow_id); > } > =20 > +static int > +mlx5_glue_destroy_flow_action(struct ibv_flow_action *action) > +{ > + return ibv_destroy_flow_action(action); > +} > + > static struct ibv_qp * > mlx5_glue_create_qp(struct ibv_pd *pd, struct ibv_qp_init_attr *qp_init_= attr) > { > @@ -388,6 +394,30 @@ > #endif > } > =20 > +static struct ibv_flow_action * > +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) Aren't these two structs also new? If so, you might have to declare it in mlx5_glue.h to avoid compilation error. Please refer to mlx5dv_flow_matcher= as an example. > +{ > +#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)data_sz; > + (void)data; > + (void)reformat_type; > + (void)ft_type; > + return NULL; > +#endif > +} > + > alignas(RTE_CACHE_LINE_SIZE) > const struct mlx5_glue *mlx5_glue =3D &(const struct mlx5_glue){ > .version =3D MLX5_GLUE_VERSION, > @@ -414,6 +444,7 @@ > .modify_wq =3D mlx5_glue_modify_wq, > .create_flow =3D mlx5_glue_create_flow, > .destroy_flow =3D mlx5_glue_destroy_flow, > + .destroy_flow_action =3D mlx5_glue_destroy_flow_action, > .create_qp =3D mlx5_glue_create_qp, > .create_qp_ex =3D mlx5_glue_create_qp_ex, > .destroy_qp =3D mlx5_glue_destroy_qp, > @@ -437,4 +468,6 @@ > .dv_create_flow_matcher =3D mlx5_glue_dv_create_flow_matcher, > .dv_destroy_flow_matcher =3D mlx5_glue_dv_destroy_flow_matcher, > .dv_create_flow =3D mlx5_glue_dv_create_flow, > + .dv_create_flow_action_packet_reformat =3D > + mlx5_glue_dv_create_flow_action_packet_reformat, > }; > diff --git a/drivers/net/mlx5/mlx5_glue.h b/drivers/net/mlx5/mlx5_glue.h > index f6e4e38..7431f58 100644 > --- a/drivers/net/mlx5/mlx5_glue.h > +++ b/drivers/net/mlx5/mlx5_glue.h > @@ -85,6 +85,7 @@ struct mlx5_glue { > struct ibv_flow *(*create_flow)(struct ibv_qp *qp, > struct ibv_flow_attr *flow); > int (*destroy_flow)(struct ibv_flow *flow_id); > + int (*destroy_flow_action)(struct ibv_flow_action *action); > struct ibv_qp *(*create_qp)(struct ibv_pd *pd, > struct ibv_qp_init_attr *qp_init_attr); > struct ibv_qp *(*create_qp_ex) > @@ -137,6 +138,12 @@ struct mlx5_glue { > struct mlx5dv_flow_match_parameters *match_value, > size_t num_actions, > struct mlx5dv_flow_action_attr *actions_attr); > + struct ibv_flow_action *(*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); > }; > =20 > const struct mlx5_glue *mlx5_glue; > --=20 > 1.8.3.1 >=20