From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80081.outbound.protection.outlook.com [40.107.8.81]) by dpdk.org (Postfix) with ESMTP id C9BCB1B276 for ; Fri, 19 Oct 2018 17:21:49 +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=J45/AOnm5A8rOwz/4lQeLx7L7nP/ek7eOIouUvIr6Mw=; b=r/S4BBXYQg7TCdqM/uzRIV7f9piOWMrvCBaf+bNQPGuZHlT5OwUXcfeP7eq/9N1BvxIBQaIZUKxZ1aPRlsTRZj2O831ly0TKUbRYZtkADH5EET767q+Iw7t2erMQk/wvkPLCMmrrEFJlstPUAmZWVp8pOFkCQlNf4Xj9jM6dTHI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=viacheslavo@mellanox.com; Received: from mellanox.com (37.142.13.130) by AM4PR05MB3268.eurprd05.prod.outlook.com (2603:10a6:205:4::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.31; Fri, 19 Oct 2018 15:21:48 +0000 From: Viacheslav Ovsiienko To: shahafs@mellanox.com, yskoh@mellanox.com Cc: dev@dpdk.org, Viacheslav Ovsiienko Date: Fri, 19 Oct 2018 15:21:10 +0000 Message-Id: <1539962470-10950-7-git-send-email-viacheslavo@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1539962470-10950-1-git-send-email-viacheslavo@mellanox.com> References: <1539784438-29242-1-git-send-email-viacheslavo@mellanox.com> <1539962470-10950-1-git-send-email-viacheslavo@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: CWXP265CA0079.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:39::19) To AM4PR05MB3268.eurprd05.prod.outlook.com (2603:10a6:205:4::25) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 25e2a117-1f3e-4166-d456-08d635d696b4 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:AM4PR05MB3268; X-Microsoft-Exchange-Diagnostics: 1; AM4PR05MB3268; 3:sWJG6FrlXZcrBCsb1pyFUZQaGXwFJvKlHGY5b2XPl5tqUaxT1K/SbfuY6b2mFvrn6/dd51Gx05iXWySyCxuKh6Ik1q/1AxvLpdiT1RVglzmTkQ6KMIJ6mFUzuddvawJpgfnIBhem7kXGmbIXTZ71HY5yuINTzr0E9IhYP6PgmqeFd+b2IEzvpifJwbb3peFeCWPvXBvc3ctve0r6ZZoTyPbyY7fwQ8VbGyBYeOVmzoE0lzcH9esaQVMdwaWWZ4g7; 25:OvfsMmUXhcurO282qc6S/O35YX8a3KmCI7BkLoNFuXro9YRuND8tKCFD2a6mo728cMsJn0HhLfBa1sWzoItbmp+E8PsYNVjbtC4YIHFcsY7yYwcDWBOuy+qOwAK07bqBjyYAZUn+ngDH/AXPhgKXR9auGe4G3ZHnL988IiXzcvmqho1wJUWP60V6BFV7WBrTs9ex7uERRhElWU7k9p2IN4F60UCR9GyciaRu/SktabiXYqIlXsPJd8fU4m87QHA9gOCd27BqZLvEATKgLZ+yV8+GsTQWif9wzuLudoF4ur926CpBjddpBch4nq0lttrVag9fLKKRpasRloesFvO8fQ==; 31:dUMLFbXKg/LR0xfvg7Y1UETnK1ZHtkZ0QGQHPYkhMbojlxv4/Ld28Xgtbv4KrjjqH+hMaE5Kp1+wBbs5FWq0+iFgbHUSeo0rxuGaLh9epldeOguc0X2U/+IK1ZVr6ZU9WVuidrMscEhz795FIP9IMhIw63QYbj3TTgGbUZIDbYdtjAFpQIGM5aSIqZDkg8eqqZfmZ0riPf9l85d9ffP3oFiC3o/pBIikqPttRQzU2rs= X-MS-TrafficTypeDiagnostic: AM4PR05MB3268: X-Microsoft-Exchange-Diagnostics: 1; AM4PR05MB3268; 20:MM8Rs2y2LhOURyHCfzgVb4/HAmFfdp9uC/oNCkDv9Rmf3xBJr0Id6Kc5SMjsPPO7Wcyywta2uRPEcGpAaXFlvwhEBkzj4e7Ul7XGf/7+6HUSj5S3sLOmsDf8w+TFpxXJae4w6slThJ47MQH4KST6BV6wII0Llsxxxzxr+b/yCkNUFklslF9NlIhbkecmg2rFFfsAdQAIg/bSYKS1ppJoojiz9WBAf/JBpM0hbII99ypL8SpHiVwKakdwz62d+IkQmCpiOzbnBpGkOSbvTUANvl3VovTTZ1AMaTmkebJCu7V7Wb4MWWkX58+IzZg9nXINMQ2uZzVeYMnTu0B1d5zF6mFD5ICjwLH+IWt+PuSKkdX3doUkMsZJzYKjiG/1UbeHeukl5LNwaRYsamySzc+wU8Z+GSnPSQmtkBligsuIr1DDJbQamNSqYZP8abT4ruCKHifEY1J97Ky2YAdhsp1DMj2Oxh0nPWL8LAPKeKf0Dk4673KyeFVekbskfcaNZaSk; 4:ptQ+G4GC1g5dcH7SHcCXxQDRI/tNsKS/YRBHFaPfCm1BORU/bVa9tDbg8r0ICEIFLZbfDageEy2KswGYR5IAOxo70vPl3XFL/EKmRK6JN/7yyHILAFQGqB9fd+K2GnRe8KhqrLJFiEkC5WW/4bzrBnKuOLmTMlSCzHcYNartA+Pt9cZ+VxktkKxP5VHJ/mW+Kco+FLmuIstQZ5FAPNhSeXIozj78EA443pJSsnUfaACAtOIdTLdpOPah07W0DIb8nZEnoU1q6P3nlFhlc2WvqA== 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)(10201501046)(93006095)(93001095)(3002001)(3231355)(944501410)(52105095)(6055026)(148016)(149066)(150057)(6041310)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(201708071742011)(7699051)(76991095); SRVR:AM4PR05MB3268; BCL:0; PCL:0; RULEID:; SRVR:AM4PR05MB3268; X-Forefront-PRVS: 0830866D19 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(39850400004)(376002)(366004)(136003)(396003)(199004)(189003)(2906002)(8676002)(50226002)(69596002)(33026002)(6116002)(3846002)(15650500001)(476003)(446003)(4326008)(11346002)(76176011)(7696005)(486006)(51416003)(386003)(186003)(956004)(81156014)(81166006)(8936002)(25786009)(2616005)(36756003)(14444005)(105586002)(86362001)(66066001)(47776003)(97736004)(16526019)(26005)(316002)(16586007)(5024004)(52116002)(68736007)(50466002)(5660300001)(478600001)(48376002)(8886007)(55016002)(21086003)(4720700003)(6636002)(6666004)(106356001)(107886003)(53936002)(7736002)(85306007)(305945005); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3268; H:mellanox.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-Exchange-Diagnostics: =?us-ascii?Q?1; AM4PR05MB3268; 23:8A0Opdx0fozwvRhQgqzbNkjO7TtUQDP2TkKPtsImw?= =?us-ascii?Q?+4DUtaLHa2gTRzzwMbt0dZk0izSVOrsnknwVcSjk4I42JdO1uXyuAJ+gzGHf?= =?us-ascii?Q?c9oaqnOuOqhsvYl+OOgJusZpfI+IkEB4BooJSUqe8wSv8QnGArchQgEiwByz?= =?us-ascii?Q?icJR0udl4VMC/OgBwxSFxaZhyu5vFVEf7iE3/23mUMeezkK5bAs/Ke99r3ZO?= =?us-ascii?Q?i9WeLf6cZM9DRH/zeeTd2DtsGyglLroeUhihYLHBfLi1Gl6ZQ6rZuNqiEWCI?= =?us-ascii?Q?+hqIWciuwLhb0XfReCH2/36RsRhOBVc/UNCsN3B5Dor54fcTpFWIxCu/iSjj?= =?us-ascii?Q?22QAEKmzz4HckXEyVx3RRlGoNhmWON6NOZPmAZsQS5TKZxYmOcZXdgkpctM/?= =?us-ascii?Q?oarq/PecKwopyG+ENshG4ctc+P/zMhRDLT6b41Dj+ht4ZpZ0eejmB/6RGRGU?= =?us-ascii?Q?kyfgOlliI+QALkP7b1byHhWsnkxG+9MP7lVW8la4rhWHo1TP9FhQtnL9MAVl?= =?us-ascii?Q?bzulkZ+6TwlqT4rXlLzQYuivPax/MwBNP65rVlW7U7LwbQKb0UOltzWymDMN?= =?us-ascii?Q?o9/C9ddP3CtUx2F5NAmhX7SL7eO+T4XWHzq5uA34yipxVpsrt6QFzrPa0TIH?= =?us-ascii?Q?nBHm3EypCKwKhZbW5i5nxwrOrEGOHPrEkiklJR0I/a1aGccsC13SThan3aDz?= =?us-ascii?Q?jPOpICIHbYL7D0IGjtb3qpsLssxxfLe6CKspDn4M/xt1+/+YRxzspatKiIt3?= =?us-ascii?Q?NmjIVQlXjG2KABBWmUsXTJjkLSKLLPTQTak3YMewohWqkTVjM0k9WYhFEp6Q?= =?us-ascii?Q?IhzueL4ZWLrOB+JB1gguOHRH/UZiMMCfhvqdjcUTw+pkzS1L0lvUxn1e7cOn?= =?us-ascii?Q?vd9WSgCxxlFFsm+1Lw2hEKmyHvmH90KC35JZBQsB41s0wqSmCseHKbd+fVkV?= =?us-ascii?Q?0I/Pt3u7LWU5y+yVhAZcmNKUFHG4Ajuj7Um5pBLz7g4plqaiudK3EE6EhYw5?= =?us-ascii?Q?bCRy7sCGQWRouBHYNk3k0Mp0nQupS9LolNBaTuKo6Y5PKA+W8m8Vtb2m8B0e?= =?us-ascii?Q?x+Pd+e4ZbxnDmB/3yPjnIOU1vnN4yA0nO5i80F8MYzvjRBDnq3klMPpOfBvZ?= =?us-ascii?Q?gHCRzDly/T7fEAlgCM93uI4byN/NXaC+C4SiI6GzHD+0zvj31RGhozZAHowz?= =?us-ascii?Q?cBxkBk4Spsxhm7GlV9+OKL546NRV+x7O8m/3KDL6MsDBCecKLQ5sy/HH3J2p?= =?us-ascii?Q?dGwdCnkn/KAKgN/kh6btGbEB2pOMSw4XeWJ7L06T8L4uQPQd+8MfWC0gQYqy?= =?us-ascii?Q?pQVDm/uyHy6NFP0ef7AC9AMYg5p2DcO78lQXhHpWNUWGppMh/hx00CD352Ad?= =?us-ascii?Q?hOjhAVwA8oVySgl8eDyN54hVQ0=3D?= X-Microsoft-Antispam-Message-Info: FhMkIv3bNPSEsap7VqBNDHM3TvIbm1kplTk+wiaQaKj/MRh0UgzDCcCd7vcn9e387ae8atOx/mALoVT/rE3zKRpWWiM4zwanUk+biapI91eOo6eRGHYLoWcHDJiv9z+KSS4IkoB+EFJrTEMvdAfmBq5Rt4j6I6jyat/0sVM1xZgxdVklTJ8rRoOyt0CvbIe/taxEw6nhmqakFU1qAGnIUF3Gqmm9GsIUlzps8YpObjXmdhhcTFlx93uI7rCbsIvIjNmvv4cjstPrmi5pd2hud4/OsMP1axj3IvRGmEkydNtnn9xpPfhDSxUZnUuluLVYcfvYDNpd466CTdQaDr5N+U06ToD+pOTYJo/qywXlXak= X-Microsoft-Exchange-Diagnostics: 1; AM4PR05MB3268; 6:AY9/t7scz81TdFaL05EUzvqo//w3isd82Gvq3mM+cjo/5JwugwKCsTmDJklbHbriZbFZi5LK6wXHck3RqUnNKwGQI5zigKmQxYWuqgg6gad3Y3Zs+WJtX+vyyuqw221u+VKac+G24FE8vcjN5NpH1URKbngw58SB1DbbVWphdWwbMabBkcDYNfAhDoasO0sBoQVISHfy+B1jBclxtPxph7kglLM3Al5XRFVioQ1f1G9oK7qrvIia/M2uRJ5ipL5OozqRKgl4P+l34ntYnioC3KuBKt6Yjz9pvNhfTpclypOTODiTZ10VgbcUzCCagPVp6bbsXUKy3JqfqaxV45pXVW2kGGXQXtcSKBOpE8ijFpsVBgmv4T/PwA1/XPbezxDX476XCvVsvVPtt//CP/DP1/Vr/HCGAkMSto/2YimRfPR3Xa2bbHhZMZuU14iKIBUr0kTdtji57cZkBb6Gmzfcxg==; 5:/QBSyTbWswwNJ2vKvWyDwR39Xep19gkDMVuq5W2f91xnMy9BMnG8TSU3OAH/tgzJlqwm37NeHoh3oVaexvaAW7OeTLuJud978q1zrRxwc9vtmfCbFSmwN+2psJx8/qS7PaZ88oD1xqldaBLQ8NEewQdd5kUR8KWeMxcmJ75S3Gk=; 7:gdH7k0jPlLo+c4rVu/PTnCiCEpl9e+YYc5KbPM9Ww+vJHJfU8gk+CmvVswSxafNqbJgNu4VRFV4/6Gp1BWXIOaJg1P987Ks7pl3NPehni/+23dKQa/O830EfwD1D2X29z580EoLZWp+fLVy0ovnS6OGDkU2TdJ94tqhiEYGjzg7ZQ/+p2L1X9r1UNnv6uyfwM5+0dRTKAXErFkM67Hqj9rXKnxW+nKUoU+XMQIky8XKxil0G+0+szBSA7NyB7J+a SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2018 15:21:48.2054 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 25e2a117-1f3e-4166-d456-08d635d696b4 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB3268 Subject: [dpdk-dev] [PATCH v3 6/6] net/mlx5: flow counters Verbs interface functions 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: Fri, 19 Oct 2018 15:21:50 -0000 This part of patchset updates the functions performing the Verbs library calls in order to support different versions of library. The functions: - flow_verbs_counter_new() - flow_verbs_counter_release() - flow_verbs_counter_query() now have the several compilations branches, depending on the counter support found in the system at compile time. The flow_verbs_counter_create() function is introduced as helper for flow_verbs_counter_new(), actually this helper create the counters with Verbs. Signed-off-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_flow.h | 6 ++ drivers/net/mlx5/mlx5_flow_verbs.c | 129 ++++++++++++++++++++++++++++--------- 2 files changed, 104 insertions(+), 31 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 69f55cf..44c7515 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -224,7 +224,13 @@ struct mlx5_flow_counter { uint32_t shared:1; /**< Share counter ID with other flow rules. */ uint32_t ref_cnt:31; /**< Reference counter. */ uint32_t id; /**< Counter ID. */ +#if defined(HAVE_IBV_DEVICE_COUNTERS_SET_V42) struct ibv_counter_set *cs; /**< Holds the counters for the rule. */ +#elif defined(HAVE_IBV_DEVICE_COUNTERS_SET_V45) + struct ibv_counters *cs; /**< Holds the counters for the rule. */ +#else + void *cs; +#endif uint64_t hits; /**< Number of packets matched by the rule. */ uint64_t bytes; /**< Number of bytes matched by the rule. */ }; diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c index f720c35..b657933 100644 --- a/drivers/net/mlx5/mlx5_flow_verbs.c +++ b/drivers/net/mlx5/mlx5_flow_verbs.c @@ -33,6 +33,59 @@ #include "mlx5_glue.h" #include "mlx5_flow.h" + +#if defined(HAVE_IBV_DEVICE_COUNTERS_SET_V42) || \ + defined(HAVE_IBV_DEVICE_COUNTERS_SET_V45) +/** + * Create Verbs flow counter with Verbs library. + * + * @param[in] dev + * Pointer to the Ethernet device structure. + * @param[in, out] counter + * PMD flow counter object, contains the counter id, + * handle of created Verbs flow counter is returned in cs field. + * + * @return + * counter->cs contains a handle of created Verbs counter, + * NULL if error occurred and rte_errno is set. + */ +static void +flow_verbs_counter_create(struct rte_eth_dev *dev, + struct mlx5_flow_counter *counter) +{ +#if defined(HAVE_IBV_DEVICE_COUNTERS_SET_V42) + struct priv *priv = dev->data->dev_private; + struct ibv_counter_set_init_attr init = { + .counter_set_id = counter->id}; + + counter->cs = mlx5_glue->create_counter_set(priv->ctx, &init); +#elif defined(HAVE_IBV_DEVICE_COUNTERS_SET_V45) + struct priv *priv = dev->data->dev_private; + struct ibv_counters_init_attr init = {0}; + struct ibv_counter_attach_attr attach = {0}; + int ret; + + counter->cs = mlx5_glue->create_counters(priv->ctx, &init); + if (!counter->cs) + return; + attach.counter_desc = IBV_COUNTER_PACKETS; + attach.index = 0; + ret = mlx5_glue->attach_counters(counter->cs, &attach, NULL); + if (!ret) { + attach.counter_desc = IBV_COUNTER_BYTES; + attach.index = 1; + ret = mlx5_glue->attach_counters + (counter->cs, &attach, NULL); + } + if (ret) { + claim_zero(mlx5_glue->destroy_counters(counter->cs)); + counter->cs = NULL; + rte_errno = ret; + } +#endif +} +#endif + /** * Get a flow counter. * @@ -49,6 +102,8 @@ static struct mlx5_flow_counter * flow_verbs_counter_new(struct rte_eth_dev *dev, uint32_t shared, uint32_t id) { +#if defined(HAVE_IBV_DEVICE_COUNTERS_SET_V42) || \ + defined(HAVE_IBV_DEVICE_COUNTERS_SET_V45) struct priv *priv = dev->data->dev_private; struct mlx5_flow_counter *cnt; @@ -60,37 +115,32 @@ cnt->ref_cnt++; return cnt; } -#ifdef HAVE_IBV_DEVICE_COUNTERS_SET_V42 - - struct mlx5_flow_counter tmpl = { - .shared = shared, - .id = id, - .cs = mlx5_glue->create_counter_set - (priv->ctx, - &(struct ibv_counter_set_init_attr){ - .counter_set_id = id, - }), - .hits = 0, - .bytes = 0, - .ref_cnt = 1, - }; - - if (!tmpl.cs) { - rte_errno = errno; - return NULL; - } cnt = rte_calloc(__func__, 1, sizeof(*cnt), 0); if (!cnt) { - claim_zero(mlx5_glue->destroy_counter_set(tmpl.cs)); rte_errno = ENOMEM; return NULL; } - *cnt = tmpl; - LIST_INSERT_HEAD(&priv->flow_counters, cnt, next); - return cnt; -#endif + cnt->id = id; + cnt->shared = shared; + cnt->ref_cnt = 1; + cnt->hits = 0; + cnt->bytes = 0; + /* Create counter with Verbs. */ + flow_verbs_counter_create(dev, cnt); + if (cnt->cs) { + LIST_INSERT_HEAD(&priv->flow_counters, cnt, next); + return cnt; + } + /* Some error occurred in Verbs library, rte_errno is set. */ + rte_free(cnt); + return NULL; +#else + (void)dev; + (void)shared; + (void)id; rte_errno = ENOTSUP; return NULL; +#endif } /** @@ -103,7 +153,11 @@ flow_verbs_counter_release(struct mlx5_flow_counter *counter) { if (--counter->ref_cnt == 0) { +#if defined(HAVE_IBV_DEVICE_COUNTERS_SET_V42) claim_zero(mlx5_glue->destroy_counter_set(counter->cs)); +#elif defined(HAVE_IBV_DEVICE_COUNTERS_SET_V45) + claim_zero(mlx5_glue->destroy_counters(counter->cs)); +#endif LIST_REMOVE(counter, next); rte_free(counter); } @@ -117,14 +171,15 @@ */ static int flow_verbs_counter_query(struct rte_eth_dev *dev __rte_unused, - struct rte_flow *flow __rte_unused, - void *data __rte_unused, + struct rte_flow *flow, void *data, struct rte_flow_error *error) { -#ifdef HAVE_IBV_DEVICE_COUNTERS_SET_V42 +#if defined(HAVE_IBV_DEVICE_COUNTERS_SET_V42) || \ + defined(HAVE_IBV_DEVICE_COUNTERS_SET_V45) if (flow->actions & MLX5_FLOW_ACTION_COUNT) { struct rte_flow_query_count *qc = data; uint64_t counters[2] = {0, 0}; +#if defined(HAVE_IBV_DEVICE_COUNTERS_SET_V42) struct ibv_query_counter_set_attr query_cs_attr = { .cs = flow->counter->cs, .query_flags = IBV_COUNTER_SET_FORCE_UPDATE, @@ -135,7 +190,12 @@ }; int err = mlx5_glue->query_counter_set(&query_cs_attr, &query_out); - +#elif defined(HAVE_IBV_DEVICE_COUNTERS_SET_V45) + int err = mlx5_glue->query_counters( + flow->counter->cs, counters, + RTE_DIM(counters), + IBV_READ_COUNTERS_ATTR_PREFER_CACHED); +#endif if (err) return rte_flow_error_set (error, err, @@ -157,6 +217,8 @@ NULL, "flow does not have counter"); #else + (void)flow; + (void)data; return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, @@ -993,7 +1055,8 @@ { const struct rte_flow_action_count *count = action->conf; struct rte_flow *flow = dev_flow->flow; -#ifdef HAVE_IBV_DEVICE_COUNTERS_SET_V42 +#if defined(HAVE_IBV_DEVICE_COUNTERS_SET_V42) || \ + defined(HAVE_IBV_DEVICE_COUNTERS_SET_V45) unsigned int size = sizeof(struct ibv_flow_spec_counter_action); struct ibv_flow_spec_counter_action counter = { .type = IBV_FLOW_SPEC_ACTION_COUNT, @@ -1012,9 +1075,12 @@ " context."); } *action_flags |= MLX5_FLOW_ACTION_COUNT; -#ifdef HAVE_IBV_DEVICE_COUNTERS_SET_V42 +#if defined(HAVE_IBV_DEVICE_COUNTERS_SET_V42) counter.counter_set_handle = flow->counter->cs->handle; flow_verbs_spec_add(dev_flow, &counter, size); +#elif defined(HAVE_IBV_DEVICE_COUNTERS_SET_V45) + counter.counters = flow->counter->cs; + flow_verbs_spec_add(dev_flow, &counter, size); #endif return 0; } @@ -1277,7 +1343,8 @@ detected_actions |= MLX5_FLOW_ACTION_RSS; break; case RTE_FLOW_ACTION_TYPE_COUNT: -#ifdef HAVE_IBV_DEVICE_COUNTERS_SET_V42 +#if defined(HAVE_IBV_DEVICE_COUNTERS_SET_V42) || \ + defined(HAVE_IBV_DEVICE_COUNTERS_SET_V45) size += sizeof(struct ibv_flow_spec_counter_action); #endif detected_actions |= MLX5_FLOW_ACTION_COUNT; -- 1.8.3.1