DPDK patches and discussions
 help / color / mirror / Atom feed
From: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
To: shahafs@mellanox.com, yskoh@mellanox.com
Cc: dev@dpdk.org, Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Subject: [dpdk-dev] [PATCH v3 2/6] net/mlx5: flow counters new configuration flags
Date: Fri, 19 Oct 2018 15:21:06 +0000	[thread overview]
Message-ID: <1539962470-10950-3-git-send-email-viacheslavo@mellanox.com> (raw)
In-Reply-To: <1539962470-10950-1-git-send-email-viacheslavo@mellanox.com>

In this part of patchset some modifications in compile configuration
flags are done. The HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT is replaced
with HAVE_IBV_DEVICE_COUNTERS_SET_V42. At this stage it is just
flag renaming. The new HAVE_IBV_DEVICE_COUNTERS_SET_V45 flag is
introduced. Both makefile and meson.build are changed, the flag
modifications are grouped, no more build system files modifications
are expected in this patchset, ones are grouped in this part.
HAVE_IBV_DEVICE_COUNTERS_SET_V45 is just introduced, no code
dependence in this part of pathset.

HAVE_IBV_DEVICE_COUNTERS_SET_V42 - is defined if system supports
the "old" flow counters functionality, MLNX_OFED version from
4.2 to 4.4 is required.

HAVE_IBV_DEVICE_COUNTERS_SET_V45 - is defined if system supports
the "new" flow counters functionality, MLNX_OVED 4.5 (or higher)
or Linux rdma-core v19 (or higher) is required.

Neither HAVE_IBV_DEVICE_COUNTERS_SET_V42 not
HAVE_IBV_DEVICE_COUNTERS_SET_V45 is defined if there is no
counters support.

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
---
 drivers/net/mlx5/Makefile          |  9 +++++++--
 drivers/net/mlx5/meson.build       |  6 ++++--
 drivers/net/mlx5/mlx5.c            |  4 ++--
 drivers/net/mlx5/mlx5_flow_verbs.c | 10 +++++-----
 drivers/net/mlx5/mlx5_glue.c       |  8 ++++----
 drivers/net/mlx5/mlx5_glue.h       |  2 +-
 6 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/drivers/net/mlx5/Makefile b/drivers/net/mlx5/Makefile
index 1e9c0b4..28547d3 100644
--- a/drivers/net/mlx5/Makefile
+++ b/drivers/net/mlx5/Makefile
@@ -157,9 +157,14 @@ mlx5_autoconf.h.new: $(RTE_SDK)/buildtools/auto-config-h.sh
 		enum ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT \
 		$(AUTOCONF_OUTPUT)
 	$Q sh -- '$<' '$@' \
-		HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT \
+		HAVE_IBV_DEVICE_COUNTERS_SET_V42 \
+ 		infiniband/verbs.h \
+ 		type 'struct ibv_counter_set_init_attr' \
+ 		$(AUTOCONF_OUTPUT)
+	$Q sh -- '$<' '$@' \
+		HAVE_IBV_DEVICE_COUNTERS_SET_V45 \
 		infiniband/verbs.h \
-		type 'struct ibv_counter_set_init_attr' \
+		type 'struct ibv_counters_init_attr' \
 		$(AUTOCONF_OUTPUT)
 	$Q sh -- '$<' '$@' \
 		HAVE_RDMA_NL_NLDEV \
diff --git a/drivers/net/mlx5/meson.build b/drivers/net/mlx5/meson.build
index c192d44..1c4ed30 100644
--- a/drivers/net/mlx5/meson.build
+++ b/drivers/net/mlx5/meson.build
@@ -79,8 +79,10 @@ if build
 	has_member_args = [
 		[ 'HAVE_IBV_MLX5_MOD_SWP', 'infiniband/mlx5dv.h',
 		'struct mlx5dv_sw_parsing_caps', 'sw_parsing_offloads' ],
-		[ 'HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT', 'infiniband/verbs.h',
-		'struct ibv_counter_set_init_attr', 'counter_set_id' ],
+		[ 'HAVE_IBV_DEVICE_COUNTERS_SET_V42', 'infiniband/verbs.h',
+ 		'struct ibv_counter_set_init_attr', 'counter_set_id' ],
+		[ 'HAVE_IBV_DEVICE_COUNTERS_SET_V45', 'infiniband/verbs.h',
+		'struct ibv_counters_init_attr', 'comp_mask' ],
 	]
 	# input array for meson symbol search:
 	# [ "MACRO to define if found", "header for the search",
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 13f2fd4..bb19085 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -739,7 +739,7 @@
 	unsigned int mprq_max_stride_size_n = 0;
 	unsigned int mprq_min_stride_num_n = 0;
 	unsigned int mprq_max_stride_num_n = 0;
-#ifdef HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT
+#ifdef HAVE_IBV_DEVICE_COUNTERS_SET_V42
 	struct ibv_counter_set_description cs_desc = { .counter_type = 0 };
 #endif
 	struct ether_addr mac;
@@ -1009,7 +1009,7 @@
 	config.hw_csum = !!(attr.device_cap_flags_ex & IBV_DEVICE_RAW_IP_CSUM);
 	DRV_LOG(DEBUG, "checksum offloading is %ssupported",
 		(config.hw_csum ? "" : "not "));
-#ifdef HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT
+#ifdef HAVE_IBV_DEVICE_COUNTERS_SET_V42
 	config.flow_counter_en = !!attr.max_counter_sets;
 	mlx5_glue->describe_counter_set(ctx, 0, &cs_desc);
 	DRV_LOG(DEBUG, "counter type = %d, num of cs = %ld, attributes = %d",
diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c
index 6ddb13b..3d6fedb 100644
--- a/drivers/net/mlx5/mlx5_flow_verbs.c
+++ b/drivers/net/mlx5/mlx5_flow_verbs.c
@@ -60,7 +60,7 @@
 		cnt->ref_cnt++;
 		return cnt;
 	}
-#ifdef HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT
+#ifdef HAVE_IBV_DEVICE_COUNTERS_SET_V42
 
 	struct mlx5_flow_counter tmpl = {
 		.shared = shared,
@@ -938,7 +938,7 @@
 {
 	const struct rte_flow_action_count *count = action->conf;
 	struct rte_flow *flow = dev_flow->flow;
-#ifdef HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT
+#ifdef HAVE_IBV_DEVICE_COUNTERS_SET_V42
 	unsigned int size = sizeof(struct ibv_flow_spec_counter_action);
 	struct ibv_flow_spec_counter_action counter = {
 		.type = IBV_FLOW_SPEC_ACTION_COUNT,
@@ -957,7 +957,7 @@
 						  " context.");
 	}
 	*action_flags |= MLX5_FLOW_ACTION_COUNT;
-#ifdef HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT
+#ifdef HAVE_IBV_DEVICE_COUNTERS_SET_V42
 	counter.counter_set_handle = flow->counter->cs->handle;
 	flow_verbs_spec_add(dev_flow, &counter, size);
 #endif
@@ -1222,7 +1222,7 @@
 			detected_actions |= MLX5_FLOW_ACTION_RSS;
 			break;
 		case RTE_FLOW_ACTION_TYPE_COUNT:
-#ifdef HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT
+#ifdef HAVE_IBV_DEVICE_COUNTERS_SET_V42
 			size += sizeof(struct ibv_flow_spec_counter_action);
 #endif
 			detected_actions |= MLX5_FLOW_ACTION_COUNT;
@@ -1665,7 +1665,7 @@
 		       void *data __rte_unused,
 		       struct rte_flow_error *error)
 {
-#ifdef HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT
+#ifdef HAVE_IBV_DEVICE_COUNTERS_SET_V42
 	if (flow->actions & MLX5_FLOW_ACTION_COUNT) {
 		struct rte_flow_query_count *qc = data;
 		uint64_t counters[2] = {0, 0};
diff --git a/drivers/net/mlx5/mlx5_glue.c b/drivers/net/mlx5/mlx5_glue.c
index 48590df..889e074 100644
--- a/drivers/net/mlx5/mlx5_glue.c
+++ b/drivers/net/mlx5/mlx5_glue.c
@@ -215,7 +215,7 @@
 mlx5_glue_create_counter_set(struct ibv_context *context,
 			     struct ibv_counter_set_init_attr *init_attr)
 {
-#ifndef HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT
+#ifndef HAVE_IBV_DEVICE_COUNTERS_SET_V42
 	(void)context;
 	(void)init_attr;
 	return NULL;
@@ -227,7 +227,7 @@
 static int
 mlx5_glue_destroy_counter_set(struct ibv_counter_set *cs)
 {
-#ifndef HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT
+#ifndef HAVE_IBV_DEVICE_COUNTERS_SET_V42
 	(void)cs;
 	return ENOTSUP;
 #else
@@ -240,7 +240,7 @@
 			       uint16_t counter_set_id,
 			       struct ibv_counter_set_description *cs_desc)
 {
-#ifndef HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT
+#ifndef HAVE_IBV_DEVICE_COUNTERS_SET_V42
 	(void)context;
 	(void)counter_set_id;
 	(void)cs_desc;
@@ -254,7 +254,7 @@
 mlx5_glue_query_counter_set(struct ibv_query_counter_set_attr *query_attr,
 			    struct ibv_counter_set_data *cs_data)
 {
-#ifndef HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT
+#ifndef HAVE_IBV_DEVICE_COUNTERS_SET_V42
 	(void)query_attr;
 	(void)cs_data;
 	return ENOTSUP;
diff --git a/drivers/net/mlx5/mlx5_glue.h b/drivers/net/mlx5/mlx5_glue.h
index f6e4e38..adee972 100644
--- a/drivers/net/mlx5/mlx5_glue.h
+++ b/drivers/net/mlx5/mlx5_glue.h
@@ -23,7 +23,7 @@
 #define MLX5_GLUE_VERSION ""
 #endif
 
-#ifndef HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT
+#ifndef HAVE_IBV_DEVICE_COUNTERS_SET_V42
 struct ibv_counter_set;
 struct ibv_counter_set_data;
 struct ibv_counter_set_description;
-- 
1.8.3.1

  parent reply	other threads:[~2018-10-19 15:21 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-20 13:34 [dpdk-dev] [RFC] mlx5: flow counters support on the linux-rdma v19 base viacheslavo
2018-09-27 23:40 ` Yongseok Koh
2018-10-03 15:29 ` [dpdk-dev] [PATCH] net/mlx5: flow counters support on the Linux-rdma " Slava Ovsiienko
2018-10-03 23:48   ` Yongseok Koh
2018-10-09 13:45     ` Shahaf Shuler
2018-10-11 14:51     ` Slava Ovsiienko
2018-10-14  5:32       ` Shahaf Shuler
2018-10-17 13:53   ` [dpdk-dev] [PATCH v2] " Viacheslav Ovsiienko
2018-10-18  6:34     ` Shahaf Shuler
2018-10-19 15:21     ` [dpdk-dev] [PATCH v3 0/6] net/mlx5: flow counters support for Linux-rdma v19 Viacheslav Ovsiienko
2018-10-19 15:21       ` [dpdk-dev] [PATCH v3 1/6] net/mlx5: flow counters object create function bugfix Viacheslav Ovsiienko
2018-10-21  9:20         ` Shahaf Shuler
2018-10-19 15:21       ` Viacheslav Ovsiienko [this message]
2018-10-21  9:20         ` [dpdk-dev] [PATCH v3 2/6] net/mlx5: flow counters new configuration flags Shahaf Shuler
2018-10-19 15:21       ` [dpdk-dev] [PATCH v3 3/6] net/mlx5: flow counters simplifying runtime support check Viacheslav Ovsiienko
2018-10-21  9:20         ` Shahaf Shuler
2018-10-19 15:21       ` [dpdk-dev] [PATCH v3 4/6] net/mlx5: flow counters mlx5 glue library update Viacheslav Ovsiienko
2018-10-21  9:20         ` Shahaf Shuler
2018-10-19 15:21       ` [dpdk-dev] [PATCH v3 5/6] net/mlx5: flow counters query function move and rename Viacheslav Ovsiienko
2018-10-21  9:20         ` Shahaf Shuler
2018-10-19 15:21       ` [dpdk-dev] [PATCH v3 6/6] net/mlx5: flow counters Verbs interface functions update Viacheslav Ovsiienko
2018-10-21  9:20         ` Shahaf Shuler
2018-10-21  9:21       ` [dpdk-dev] [PATCH v3 0/6] net/mlx5: flow counters support for Linux-rdma v19 Shahaf Shuler
2018-10-23 10:04       ` [dpdk-dev] " Slava Ovsiienko
2018-10-23 10:04         ` [dpdk-dev] [PATCH v4 1/8] net/mlx5: fix flow counters creation Slava Ovsiienko
2018-10-23 10:04         ` [dpdk-dev] [PATCH v4 2/8] net/mlx5: rename flow counter configuration macro Slava Ovsiienko
2018-10-23 10:04         ` [dpdk-dev] [PATCH v4 3/8] net/mlx5: introduce new flow counters " Slava Ovsiienko
2018-10-23 10:04         ` [dpdk-dev] [PATCH v4 5/8] net/mlx5: relocate flow counters query function Slava Ovsiienko
2018-10-23 10:04         ` [dpdk-dev] [PATCH v4 4/8] net/mlx5: simplify flow counters support check Slava Ovsiienko
2018-10-23 10:04         ` [dpdk-dev] [PATCH v4 6/8] net/mlx5: add new flow counter Verbs API to glue library Slava Ovsiienko
2018-10-23 10:04         ` [dpdk-dev] [PATCH v4 7/8] net/mlx5: remove unnecessary structure initializers Slava Ovsiienko
2018-10-23 10:04         ` [dpdk-dev] [PATCH v4 8/8] net/mlx5: support new flow counter API Slava Ovsiienko
2018-10-24 16:31           ` Ferruh Yigit
2018-10-24 16:35             ` Ferruh Yigit
2018-10-24 17:25               ` Shahaf Shuler
2018-10-25  8:59                 ` Ferruh Yigit
2018-10-27 10:54           ` [dpdk-dev] [PATCH] net/mlx5: fix flow counters deletion in Verbs Slava Ovsiienko
2018-10-28 12:53             ` Shahaf Shuler
     [not found]       ` <1540289541-30019-1-git-send-email-viacheslavo@mellanox.com>
2018-10-24 11:02         ` [dpdk-dev] [PATCH v4 0/8] net/mlx5: flow counters support for Linux-rdma v19 Shahaf Shuler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1539962470-10950-3-git-send-email-viacheslavo@mellanox.com \
    --to=viacheslavo@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=shahafs@mellanox.com \
    --cc=yskoh@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).