From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80047.outbound.protection.outlook.com [40.107.8.47]) by dpdk.org (Postfix) with ESMTP id BF5121B276 for ; Fri, 19 Oct 2018 17:21:47 +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=ZigxcoT8KGkVwJu0/VFJhn39/A3JwEU8uNLVRrWmX9k=; b=Kqhr3Qs/woZ6GK5sr4Bd7dUoiyTwIQm6Cl8Q9n/pArZAS6YFziARHnkYGLLzF9lL8krvYWtcHPsj8fWiufwEi1prHpqR671FOLNZxE48OeBDHYPyvrwW+CvimhAXOmIWXPS27pCKV4VnycjqFiVNQtoUr9qBWc+j6ngzCk5qNIY= 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:46 +0000 From: Viacheslav Ovsiienko To: shahafs@mellanox.com, yskoh@mellanox.com Cc: dev@dpdk.org, Viacheslav Ovsiienko Date: Fri, 19 Oct 2018 15:21:08 +0000 Message-Id: <1539962470-10950-5-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: fd00db64-762b-4d93-4510-08d635d69581 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:tQaLGMYOLDYLQSY9gZG9C1Y1l5kRhZMsEqPrE06j9MnzljHGnWvylvm3kjUEphm/zM+cqGhx3q8mDFTATrtUL3UMdtG/Ev6s0k0Bs0jOCTAk+Hn6pi0e0YGbF2GzjKuGIGKPLRk172RzFez6Hv8BqUOQoyRh9raBrLn/f3H+/nhigtkFU6CG8Hn8ZwZ+qTd1cAZY1W7JbEwhoGal88Eg6+/LiOtyzOL+ihNgGuHabAnWo4htntLLH+s9AB/WWkn0; 25:EBuJxyCFJDZwcE3xbs5Bfdc0FdrPCEdGu4VdlruzVndn3QBCkSgSmndg2WkkbYRdwbV2MhdeVO9NuHcHPtfIVM3rDSDxtiBW+lbHfHJJ4JmYJVHHZnifdHwmrWqy0GZ5Hge6TonsR0kwIahXhFEa6W7RSjz8fVCEn9tOHJNha4wcZpqXGXRjyiLR1bvKZH+D5Odx7dFIEPHcG2jtLzN10GK1weOW6PAuzVBOsMJ+1JB0TpZg6tSvkAPIFSobyI+0S/Oof7h2kq1ZH9EE6L0itrOVrBOxOsYEG+kurXkXBRBrhOVhtG3cQLhny0m8twmGGH2GGz9YZSv4Dl5Wv/DjnA==; 31:NaVK5tZj5jsJowgfVQz4gXLZvyWVPw/6feqq6oeoL3tgSTz+uMq078wOxJam9Wj/+IP1bB5CQ7x5QIR6KgKu30n/pKYfZQnyOplroXIEjEdEfeULaIWa79k1oBa1OL0sho8A+APrJ9dk54ug8gTyX+aNrRsoj8tpVyNxWBrGzWGrwS2LRKTGy6huIvhpG7vqQKBPh7c3baa8cV0g7kQuHFN8LWxIqWH14MUl0GpWGHw= X-MS-TrafficTypeDiagnostic: AM4PR05MB3268: X-Microsoft-Exchange-Diagnostics: 1; AM4PR05MB3268; 20:Tploilt+IoDBtALTM1e/w9fuBF4PGULKhDg3aoK0PMCcYo25ShPyTRkFn6kOjGG9a3tfoPQoVw9NTsJ1zflxT3fWhpvheC+4OUirUflBzk+hLnFgKpCx8XkaEI4cT9dDTvZecPOJZaWbKcw+GAZuYA/VhjejevLIHAeW7WVbkURrKXmBHELU0bHM5rOMdpPO1gq7cmQQEE4fXJT8rZ0UgCLUZTOzQaMcImbZuP91cnZ6htiDYVqlx8vIJgI0L3mJdPebUksfeHZ0O6BrNUqLnKlnMdgrVAW8gwWIqvVnwnWNOvFtQ59ZT2VEY47OC2EVWtZAtKQ8PEsjGWl0patadnb97a/bOXW0UJptHbwgvl4NgHz2dGI/qXd3pABFZhxiUnCVecNWclwTNm2DgDhhEi5L97+11h+9OlVNbJASDGqmBroEjVmRL0RTeex3aVriT2Uq5dz0fvv4icu+UNyZQKWxltnWgOSRZphAmFi9ySY+zgmeTb7jSthK6kGL139A; 4:ZoaNyWU8pAzbok7m5Plegt5h0cVDH16W1rwJMDccMiEpojB2ZibjtVroUWKKBorAb76QkMeHik1+0u3X1nS7MgiASeA3GVFLvEIrN+Eyx6XcMFihrsBCl1uKfhIpxJrdiK2VkmqygJqrFDH4rqfYdnMUVwEKKHBXaUr/tEYxcuynrpf9BykIH2Vg0z2lyQPsD0nBCQ06XZ87ggRVzkAuZdCZIxfZMPdNjmP625tFS2pWemEceHi7tbNEzeXY/VUjej9KxYsEvKS92yvJ4sLqng== 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)(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:KKqlTUGxSLJQlGv/nZsUmvO9Favh+OZn11N7j6Toe?= =?us-ascii?Q?2HyGsfJesrCuXa77MSrkLkgcDX2kdATUB3PnWkmL01+JXSP69dPVGVd3LF7P?= =?us-ascii?Q?ssQmgN6qMzuDV9Xsx/OKyNyDnMkAFVEXOIE/+s2fAtSiU+VV02gNMQJMo5mn?= =?us-ascii?Q?x4pozhhJd+Old+aX74987ZAL1lruauEvZ/8LV+Uk2GPwLwYi9rWHhL1/jdsl?= =?us-ascii?Q?0abNJk3Aq5Q/EQBVcN7Zj0D+7nDwJc1ECTjQWYDeke3CsmEo7FEbqTIuOAuf?= =?us-ascii?Q?quzIRq1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R+r4J28nqepkrlmLLnVMwoUqCbk/N3ymscnaX9RCMLI2r0hS7m8z/HozXMMsfQ25/sOdOKguQ==; 5:B+uZO7iYD8mGB+ngroLFRqceW3gVPFGPACdEVkNTj2MqZb8+FKxhXFTymHPJxD0Gg0JT4r2c2IfLRRW0ZDnEF0CZ9AuRs8fAi8HK8C1gR4jvS3WupuHKND8zL0dOfAkSJPBJx8kdtRWkYxF+In3/RggdJPsqMeVH/ecskdvWjXQ=; 7:xWo5Yi+9dFO0O7F8sJAMhLRTE881d70GC5Pm1G9W2ap4t0xFS5eZ7OsnV9qwfKH1IBldOpvj8Pt8fBg/l1VPXtjLYx7yRDQzb2yUF3CdLv8Jv5nqDjv0T94h2nzwfaELrPOhadsGEtlD7nhULymzxnMEsWtAjx1AETV4g1+m8rYFnPMBsXIp6brXwK6LO6BdaPyNkZt+WQP2VDvt8c+OPnPhARewr9+ezF0GlO5sMKJI1kDT63wW+IGUv8x6yn4F SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2018 15:21:46.2054 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fd00db64-762b-4d93-4510-08d635d69581 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 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: Fri, 19 Oct 2018 15:21:48 -0000 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 configuration flags the functions perform actual Verbs library calls or return an error with meaning "feature is not supported" (NULL or ENOTSUP). Signed-off-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_glue.c | 60 ++++++++++++++++++++++++++++++++++++++++++++ drivers/net/mlx5/mlx5_glue.h | 17 +++++++++++++ 2 files changed, 77 insertions(+) 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 } +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 = mlx5_glue_destroy_counter_set, .describe_counter_set = mlx5_glue_describe_counter_set, .query_counter_set = mlx5_glue_query_counter_set, + .create_counters = mlx5_glue_create_counters, + .destroy_counters = mlx5_glue_destroy_counters, + .attach_counters = mlx5_glue_attach_counters, + .query_counters = mlx5_glue_query_counters, .ack_async_event = mlx5_glue_ack_async_event, .get_async_event = mlx5_glue_get_async_event, .port_state_str = 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 +#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