From mboxrd@z Thu Jan 1 00:00:00 1970 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+H4cL2ajKn8JaKy2ls/TgQL88baX3RHkyJI43bXbCf0=; b=XkxYVyir5NmhkhCabMzv084Dyzky+ZT+ymbqeLKudrFpJ4U54zPmJT/iYe2Pi1fimNcg3qtJAjamiROS6ENEmbbdNS+Hw0fKyLEPQkiinpDCX9fw3m79/qnG+sn+Rf+coomKGedOcBsJdbDrisghlvay2yKm1iYkRLb/xd05UyQ= Received: from DB7PR05MB4426.eurprd05.prod.outlook.com (52.134.109.15) by DB7PR05MB4891.eurprd05.prod.outlook.com (20.176.235.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1250.25; Sun, 21 Oct 2018 09:20:49 +0000 Received: from DB7PR05MB4426.eurprd05.prod.outlook.com ([fe80::80e:e6b:baf2:d973]) by DB7PR05MB4426.eurprd05.prod.outlook.com ([fe80::80e:e6b:baf2:d973%3]) with mapi id 15.20.1250.028; Sun, 21 Oct 2018 09:20:49 +0000 From: Shahaf Shuler To: Slava Ovsiienko , Yongseok Koh CC: "dev@dpdk.org" Thread-Topic: [PATCH v3 4/6] net/mlx5: flow counters mlx5 glue library update Thread-Index: AQHUZ79zwNeasq8/GkCRKUmKLprEYaUpZmoQ 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> In-Reply-To: <1539962470-10950-5-git-send-email-viacheslavo@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=shahafs@mellanox.com; x-originating-ip: [31.154.10.105] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB7PR05MB4891; 6:mM9Q6An+yRYj2K6FQReP0HnrcXt9jYc8gYtR2KUYWcWWLwVwvxs7LjZPeqqfxeaeas5zw9so7RsHb3feaiwGJa7j4+6LWR2NrDNmI4GlCAbl2764mS+U087rUZfvb2HBopRr9/uXyxreBgaIiHIVUVCipr1Zxa4VP0eLS81NVdb3ejq2UP0wpPJD/SuxCEyMZJHF65XXci9keKxbILwHVaaf3GZRj5HkXtklRB+7Rd5zkqbCEl9jV+s4WUQyILMGBH4G9SvAhQ4cQS+pKVDGdBDkhdQoWjIRrTw+Bo3QACp6X0XZ8bqQUC4YILXkbKQSTZq5p4sjJag9ekpCXqzbn+EM3H2ST3qvAt5B7N5gyoW4ZkhVErDvm5Ii+Qfi6nh86H4hIHieJjM316WM4VaQ4iDuGo6tvnrankfhIyNHSXAaGwbgsas9lDPHvaQVC9ek/kDZePh5PtxZQyRl6sULZw==; 5:IF9RsBp/mtpMmHbqHfJWA9ISK1av5eyqViVxnIVDL35WcLQCIAEWvreNQ+fb7kh2af/vdtsM6kferTx1CXgQvIgekZEU7qVIcJ2QYgUUfkME6NJ5Ju7X8bJW5rYD5+8YANMqFnC5D184zl8N+z1dAfmUumENS4VSGu+lZEQ2j9I=; 7:uqAekm8u0htV0uJsGz1Hy1MFeLoknlvPl89z/6ENpguN3hzxmgzjbj00xx95sbKxnk+CCD43mVBXE8W10K9ukm87Z760fpWchvQopHMTZ9n/gHTTw9dWMFGET+Wcy3nnMI/1N6+FGfNxU3Dvjm4/K74z2huI8doXVavTbaIOdH5Aw6NDkuyJchZbvDokKFXInolyV1jgXkzkira9bO6QOyogc12FLd3ifRxC7P0BfbtHs5E5AsjQh/L2TzhykruB x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 55f4b504-2701-4d48-53da-08d637367d69 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB7PR05MB4891; x-ms-traffictypediagnostic: DB7PR05MB4891: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3002001)(10201501046)(3231355)(944501410)(52105095)(6055026)(148016)(149066)(150057)(6041310)(20161123562045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(201708071742011)(7699051)(76991095); SRVR:DB7PR05MB4891; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB4891; x-forefront-prvs: 083289FD26 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(136003)(396003)(376002)(39860400002)(346002)(199004)(189003)(33656002)(68736007)(74316002)(476003)(305945005)(81166006)(486006)(81156014)(2906002)(316002)(15650500001)(7736002)(97736004)(71200400001)(71190400001)(14454004)(6246003)(478600001)(6116002)(3846002)(5250100002)(2900100001)(14444005)(7696005)(5024004)(5660300001)(26005)(9686003)(76176011)(66066001)(86362001)(186003)(25786009)(102836004)(55016002)(256004)(53936002)(4326008)(6636002)(99286004)(446003)(110136005)(106356001)(229853002)(8936002)(6506007)(8676002)(11346002)(6436002)(105586002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB4891; H:DB7PR05MB4426.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 9qRHU84HHWD9XGGtMZPIyEPLLEagFGLQmo3sblIl4KN4f/P/GoY2TQopQJzhcCj3yXYKLJCTbIR1fu3UyzGy9FJdvhW02Vh1UktH1VijLlw8zK1e5Me4eoqLyg5rBv9Z31QUMRlQ2dCiRaMtdNi+v1O1YLL8LS/cQi/TrbmATc+87SQE7kToIdNwoNBNRm7ZW1AZNMdcs7CClEczWmNPJkTai0I/SEbTk3cVKHQK5fj/FnN/cqUXMAI6HgPopvze76NTw3o4XJ6VkI6DtIaLjHRQ7na9c2c+xxJGmfrLSzIkN5AvxbjmCi3FB1RSdSudGBLo4DK2jnrKtLapxSQGfCGIcuVL7AvrUn05VVn1+vU= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 55f4b504-2701-4d48-53da-08d637367d69 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Oct 2018 09:20:49.0669 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB4891 Subject: Re: [dpdk-dev] [PATCH v3 4/6] net/mlx5: flow counters mlx5 glue library update X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Oct 2018 09:20:50 -0000 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