From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shahaf Shuler Subject: Re: [PATCH v3 4/6] net/mlx5: flow counters mlx5 glue library update Date: Sun, 21 Oct 2018 09:20:49 +0000 Message-ID: References: <1539784438-29242-1-git-send-email-viacheslavo@mellanox.com> <1539962470-10950-1-git-send-email-viacheslavo@mellanox.com> <1539962470-10950-5-git-send-email-viacheslavo@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: "dev@dpdk.org" To: Slava Ovsiienko , Yongseok Koh Return-path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0074.outbound.protection.outlook.com [104.47.0.74]) by dpdk.org (Postfix) with ESMTP id 2A4EE2C52 for ; Sun, 21 Oct 2018 11:20:50 +0200 (CEST) In-Reply-To: <1539962470-10950-5-git-send-email-viacheslavo@mellanox.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Friday, October 19, 2018 6:21 PM, Slava Ovsiienko: > Subject: [PATCH v3 4/6] net/mlx5: flow counters mlx5 glue library update >=20 How about: "net/mlx5: add new flow counter verbs API to glue library > This part of patchset updates the mlx5 glue library, new counter support > function pointers are added to the glue linking structure mlx5_glue. This > structure now contains the pointers to the both versions of counter > supporting functions due to compatibility issues. Depending on configurat= ion > flags the functions perform actual Verbs library calls or return an error= with > meaning "feature is not supported" (NULL or ENOTSUP). >=20 >>From previous patch comments, this patch should declare the new macro (V45) > Signed-off-by: Viacheslav Ovsiienko > --- > drivers/net/mlx5/mlx5_glue.c | 60 > ++++++++++++++++++++++++++++++++++++++++++++ > drivers/net/mlx5/mlx5_glue.h | 17 +++++++++++++ > 2 files changed, 77 insertions(+) >=20 > diff --git a/drivers/net/mlx5/mlx5_glue.c b/drivers/net/mlx5/mlx5_glue.c > index 889e074..1afb114 100644 > --- a/drivers/net/mlx5/mlx5_glue.c > +++ b/drivers/net/mlx5/mlx5_glue.c > @@ -263,6 +263,62 @@ > #endif > } >=20 > +static struct ibv_counters * > +mlx5_glue_create_counters(struct ibv_context *context, > + struct ibv_counters_init_attr *init_attr) { #ifndef > +HAVE_IBV_DEVICE_COUNTERS_SET_V45 > + (void)context; > + (void)init_attr; > + return NULL; > +#else > + return ibv_create_counters(context, init_attr); #endif } > + > +static int > +mlx5_glue_destroy_counters(struct ibv_counters *counters) { #ifndef > +HAVE_IBV_DEVICE_COUNTERS_SET_V45 > + (void)counters; > + return ENOTSUP; > +#else > + return ibv_destroy_counters(counters); #endif } > + > +static int > +mlx5_glue_attach_counters(struct ibv_counters *counters, > + struct ibv_counter_attach_attr *attr, > + struct ibv_flow *flow) > +{ > +#ifndef HAVE_IBV_DEVICE_COUNTERS_SET_V45 > + (void)counters; > + (void)attr; > + (void)flow; > + return ENOTSUP; > +#else > + return ibv_attach_counters_point_flow(counters, attr, flow); #endif > } > + > +static int > +mlx5_glue_query_counters(struct ibv_counters *counters, > + uint64_t *counters_value, > + uint32_t ncounters, > + uint32_t flags) > +{ > +#ifndef HAVE_IBV_DEVICE_COUNTERS_SET_V45 > + (void)counters; > + (void)counters_value; > + (void)ncounters; > + (void)flags; > + return ENOTSUP; > +#else > + return ibv_read_counters(counters, counters_value, ncounters, > flags); > +#endif } > + > static void > mlx5_glue_ack_async_event(struct ibv_async_event *event) { @@ -424,6 > +480,10 @@ > .destroy_counter_set =3D mlx5_glue_destroy_counter_set, > .describe_counter_set =3D mlx5_glue_describe_counter_set, > .query_counter_set =3D mlx5_glue_query_counter_set, > + .create_counters =3D mlx5_glue_create_counters, > + .destroy_counters =3D mlx5_glue_destroy_counters, > + .attach_counters =3D mlx5_glue_attach_counters, > + .query_counters =3D mlx5_glue_query_counters, > .ack_async_event =3D mlx5_glue_ack_async_event, > .get_async_event =3D mlx5_glue_get_async_event, > .port_state_str =3D mlx5_glue_port_state_str, diff --git > a/drivers/net/mlx5/mlx5_glue.h b/drivers/net/mlx5/mlx5_glue.h index > adee972..44bfefe 100644 > --- a/drivers/net/mlx5/mlx5_glue.h > +++ b/drivers/net/mlx5/mlx5_glue.h > @@ -31,6 +31,12 @@ > struct ibv_query_counter_set_attr; > #endif >=20 > +#ifndef HAVE_IBV_DEVICE_COUNTERS_SET_V45 struct ibv_counters; struct > +ibv_counters_init_attr; struct ibv_counter_attach_attr; #endif > + > #ifndef HAVE_IBV_DEVICE_TUNNEL_SUPPORT > struct mlx5dv_qp_init_attr; > #endif > @@ -106,6 +112,17 @@ struct mlx5_glue { > struct ibv_counter_set_description *cs_desc); > int (*query_counter_set)(struct ibv_query_counter_set_attr > *query_attr, > struct ibv_counter_set_data *cs_data); > + struct ibv_counters *(*create_counters) > + (struct ibv_context *context, > + struct ibv_counters_init_attr *init_attr); > + int (*destroy_counters)(struct ibv_counters *counters); > + int (*attach_counters)(struct ibv_counters *counters, > + struct ibv_counter_attach_attr *attr, > + struct ibv_flow *flow); > + int (*query_counters)(struct ibv_counters *counters, > + uint64_t *counters_value, > + uint32_t ncounters, > + uint32_t flags); > void (*ack_async_event)(struct ibv_async_event *event); > int (*get_async_event)(struct ibv_context *context, > struct ibv_async_event *event); > -- > 1.8.3.1