Skip to contentSkip to conversation

net/mlx5/hws: fix alias_rtc_0 print location in debug dump

PATCH Superseded Hamdan Igbaria 3 participants 12 messages Jan 26, 2023 – Feb 14, 2023 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 net/mlx5/hws: fix alias_rtc_0 print location in debug dump

Fix alias_rtc_0 print location in debug dump, move it to the end of matcher dumped info instead of the middle, to keep the dump compatibility.

Fixes dd2845361a58 ("net/mlx5/hws: add debug details for cross gvmi")
---
 drivers/net/mlx5/hws/mlx5dr_debug.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/mlx5/hws/mlx5dr_debug.c +6 -6
index 0815327b18..4bbdb767ee 100644
@@ -208,13 +208,11 @@ static int mlx5dr_debug_dump_matcher(FILE *f, struct mlx5dr_matcher *matcher)
 		ste_1 = NULL;
 	}
 
-	ret = fprintf(f, ",%d,%d,%d,%d,%d",
+	ret = fprintf(f, ",%d,%d,%d,%d",
 		      matcher->match_ste.rtc_0 ? matcher->match_ste.rtc_0->id : 0,
 		      ste_0 ? (int)ste_0->id : -1,
 		      matcher->match_ste.rtc_1 ? matcher->match_ste.rtc_1->id : 0,
-		      ste_1 ? (int)ste_1->id : -1,
-		      is_shared && !is_root ?
-		      matcher->match_ste.aliased_rtc_0->id : 0);
+		      ste_1 ? (int)ste_1->id : -1);
 	if (ret < 0)
 		goto out_err;
 
@@ -229,11 +227,13 @@ static int mlx5dr_debug_dump_matcher(FILE *f, struct mlx5dr_matcher *matcher)
 		ste_1 = NULL;
 	}
 
-	ret = fprintf(f, ",%d,%d,%d,%d\n",
+	ret = fprintf(f, ",%d,%d,%d,%d,%d\n",
 		      matcher->action_ste.rtc_0 ? matcher->action_ste.rtc_0->id : 0,
 		      ste_0 ? (int)ste_0->id : -1,
 		      matcher->action_ste.rtc_1 ? matcher->action_ste.rtc_1->id : 0,
-		      ste_1 ? (int)ste_1->id : -1);
+		      ste_1 ? (int)ste_1->id : -1,
+		      is_shared && !is_root ?
+		      matcher->match_ste.aliased_rtc_0->id : 0);
 	if (ret < 0)
 		goto out_err;
 
Signature · 1 line
2.31.1
#1 lore raw

PATCH 2/5 net/mlx5/hws: change STC array size to 32K

Change STC array size from 16K to 32K.
This change allows supporting more actions
using HWS.

---
 drivers/net/mlx5/hws/mlx5dr_pool.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/mlx5/hws/mlx5dr_pool.h +1 -1
index cd12c3ab9a..4edc4b8c79 100644
@@ -10,7 +10,7 @@ enum mlx5dr_pool_type {
 	MLX5DR_POOL_TYPE_STC,
 };
 
-#define MLX5DR_POOL_STC_LOG_SZ 14
+#define MLX5DR_POOL_STC_LOG_SZ 15
 
 #define MLX5DR_POOL_RESOURCE_ARR_SZ 100
 
Signature · 1 line
2.31.1
#2 lore raw

PATCH 3/5 net/mlx5/hws: support STC info dump

In reply to Hamdan Igbaria

Dump the STC info in debug dump.

---
 drivers/net/mlx5/hws/mlx5dr_debug.c | 55 +++++++++++++++++++++++++++++
 drivers/net/mlx5/hws/mlx5dr_debug.h |  1 +
 2 files changed, 56 insertions(+)
drivers/net/mlx5/hws/mlx5dr_debug.c +55 -0
index 4bbdb767ee..6a2644693b 100644
@@ -435,6 +435,57 @@ static int mlx5dr_debug_dump_context_info(FILE *f, struct mlx5dr_context *ctx)
 	return 0;
 }
 
+static int
+mlx5dr_debug_dump_context_stc_resource(FILE *f,
+				       struct mlx5dr_context *ctx,
+				       uint32_t tbl_type,
+				       struct mlx5dr_pool_resource *resource)
+{
+	int ret;
+
+	ret = fprintf(f, "%d,0x%" PRIx64 ",%u,%u\n",
+		      MLX5DR_DEBUG_RES_TYPE_CONTEXT_STC,
+		      (uint64_t)(uintptr_t)ctx,
+		      tbl_type,
+		      resource->base_id);
+	if (ret < 0) {
+		rte_errno = EINVAL;
+		return rte_errno;
+	}
+
+	return 0;
+}
+
+static int mlx5dr_debug_dump_context_stc(FILE *f, struct mlx5dr_context *ctx)
+{
+	struct mlx5dr_pool *stc_pool;
+	int ret;
+	int i;
+
+	for (i = 0; i < MLX5DR_TABLE_TYPE_MAX; i++) {
+		stc_pool = ctx->stc_pool[i];
+
+		if (!stc_pool)
+			continue;
+
+		if (stc_pool->resource[0] != NULL) {
+			ret = mlx5dr_debug_dump_context_stc_resource(f, ctx, i,
+								     stc_pool->resource[0]);
+			if (ret)
+				return ret;
+		}
+
+		if (i == MLX5DR_TABLE_TYPE_FDB && stc_pool->mirror_resource[0] != NULL) {
+			ret = mlx5dr_debug_dump_context_stc_resource(f, ctx, i,
+								     stc_pool->mirror_resource[0]);
+			if (ret)
+				return ret;
+		}
+	}
+
+	return 0;
+}
+
 static int mlx5dr_debug_dump_context(FILE *f, struct mlx5dr_context *ctx)
 {
 	struct mlx5dr_table *tbl;
@@ -448,6 +499,10 @@ static int mlx5dr_debug_dump_context(FILE *f, struct mlx5dr_context *ctx)
 	if (ret)
 		return ret;
 
+	ret = mlx5dr_debug_dump_context_stc(f, ctx);
+	if (ret)
+		return ret;
+
 	LIST_FOREACH(tbl, &ctx->head, next) {
 		ret = mlx5dr_debug_dump_table(f, tbl);
 		if (ret)
drivers/net/mlx5/hws/mlx5dr_debug.h +1 -0
index cf00170f7d..4702ed0ea5 100644
@@ -13,6 +13,7 @@ enum mlx5dr_debug_res_type {
 	MLX5DR_DEBUG_RES_TYPE_CONTEXT_CAPS = 4002,
 	MLX5DR_DEBUG_RES_TYPE_CONTEXT_SEND_ENGINE = 4003,
 	MLX5DR_DEBUG_RES_TYPE_CONTEXT_SEND_RING = 4004,
+	MLX5DR_DEBUG_RES_TYPE_CONTEXT_STC = 4005,
 
 	MLX5DR_DEBUG_RES_TYPE_TABLE = 4100,
 
Signature · 1 line
2.31.1
#3 lore raw

PATCH 4/5 net/mlx5/hws: support IP version matching for non relaxed

In reply to Hamdan Igbaria

Enable matching on IP version explicitly for non relaxed mode. This will add support for the user cases where he needs to match on ip version explicitly, for such case to have outer ipv6 and inner ipv4 packets, etc.

---
 drivers/net/mlx5/hws/mlx5dr_definer.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/net/mlx5/hws/mlx5dr_definer.c +16 -0
index 6b98eb8c96..79f4f2667f 100644
@@ -539,6 +539,14 @@ mlx5dr_definer_conv_item_ipv4(struct mlx5dr_definer_conv_data *cd,
 		return rte_errno;
 	}
 
+	if (m->version) {
+		fc = &cd->fc[DR_CALC_FNAME(IP_VERSION, inner)];
+		fc->item_idx = item_idx;
+		fc->tag_set = &mlx5dr_definer_ipv4_version_set;
+		fc->tag_mask_set = &mlx5dr_definer_ones_set;
+		DR_CALC_SET(fc, eth_l2, l3_type, inner);
+	}
+
 	if (m->fragment_offset) {
 		fc = &cd->fc[DR_CALC_FNAME(IP_FRAG, inner)];
 		fc->item_idx = item_idx;
@@ -628,6 +636,14 @@ mlx5dr_definer_conv_item_ipv6(struct mlx5dr_definer_conv_data *cd,
 		DR_CALC_SET(fc, eth_l4, ip_fragmented, inner);
 	}
 
+	if (DR_GET(header_ipv6_vtc, &m->hdr.vtc_flow, version)) {
+		fc = &cd->fc[DR_CALC_FNAME(IP_VERSION, inner)];
+		fc->item_idx = item_idx;
+		fc->tag_set = &mlx5dr_definer_ipv6_version_set;
+		fc->tag_mask_set = &mlx5dr_definer_ones_set;
+		DR_CALC_SET(fc, eth_l2, l3_type, inner);
+	}
+
 	if (DR_GET(header_ipv6_vtc, &m->hdr.vtc_flow, tos)) {
 		fc = &cd->fc[DR_CALC_FNAME(IP_TOS, inner)];
 		fc->item_idx = item_idx;
Signature · 1 line
2.31.1
#4 lore raw

PATCH 5/5 net/mlx5: support HW steering debug dump

In reply to Hamdan Igbaria

Add the ability for the DPDK apps to call
HW steering relevant debug data dump function.

---
 drivers/net/mlx5/mlx5_flow.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)
drivers/net/mlx5/mlx5_flow.c +13 -6
index f5e2831480..8e3da63299 100644
@@ -9857,10 +9857,13 @@ mlx5_flow_dev_dump(struct rte_eth_dev *dev, struct rte_flow *flow_idx,
 #ifdef HAVE_IBV_FLOW_DV_SUPPORT
 		if (mlx5_flow_dev_dump_sh_all(dev, file, error))
 			return -EINVAL;
+
+		if (sh->config.dv_flow_en == 2)
+			return mlx5dr_debug_dump(priv->dr_ctx, file);
 #endif
 		return mlx5_devx_cmd_flow_dump(sh->fdb_domain,
-					sh->rx_domain,
-					sh->tx_domain, file);
+					       sh->rx_domain,
+					       sh->tx_domain, file);
 	}
 	/* dump one */
 	flow = mlx5_ipool_get(priv->flows[MLX5_FLOW_TYPE_GEN],
@@ -9878,10 +9881,14 @@ mlx5_flow_dev_dump(struct rte_eth_dev *dev, struct rte_flow *flow_idx,
 		if (!dh)
 			return -ENOENT;
 		if (dh->drv_flow) {
-			ret = mlx5_devx_cmd_flow_single_dump(dh->drv_flow,
-					file);
-			if (ret)
-				return -ENOENT;
+			if (sh->config.dv_flow_en == 2) {
+				return -ENOTSUP;
+			} else {
+				ret = mlx5_devx_cmd_flow_single_dump(dh->drv_flow,
+								     file);
+				if (ret)
+					return -ENOENT;
+			}
 		}
 		handle_idx = dh->next.next;
 	}
Signature · 1 line
2.31.1
#5 lore raw

PATCH v2 1/5 net/mlx5/hws: fix alias_rtc_0 print location in debug dump

In reply to Hamdan Igbaria

Fix alias_rtc_0 print location in debug dump, move it to the end of matcher dumped info instead of the middle, to keep the dump compatibility.

Fixes dd2845361a58 ("net/mlx5/hws: add debug details for cross gvmi")
---
 drivers/net/mlx5/hws/mlx5dr_debug.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/mlx5/hws/mlx5dr_debug.c +6 -6
index 0815327b18..4bbdb767ee 100644
@@ -208,13 +208,11 @@ static int mlx5dr_debug_dump_matcher(FILE *f, struct mlx5dr_matcher *matcher)
 		ste_1 = NULL;
 	}
 
-	ret = fprintf(f, ",%d,%d,%d,%d,%d",
+	ret = fprintf(f, ",%d,%d,%d,%d",
 		      matcher->match_ste.rtc_0 ? matcher->match_ste.rtc_0->id : 0,
 		      ste_0 ? (int)ste_0->id : -1,
 		      matcher->match_ste.rtc_1 ? matcher->match_ste.rtc_1->id : 0,
-		      ste_1 ? (int)ste_1->id : -1,
-		      is_shared && !is_root ?
-		      matcher->match_ste.aliased_rtc_0->id : 0);
+		      ste_1 ? (int)ste_1->id : -1);
 	if (ret < 0)
 		goto out_err;
 
@@ -229,11 +227,13 @@ static int mlx5dr_debug_dump_matcher(FILE *f, struct mlx5dr_matcher *matcher)
 		ste_1 = NULL;
 	}
 
-	ret = fprintf(f, ",%d,%d,%d,%d\n",
+	ret = fprintf(f, ",%d,%d,%d,%d,%d\n",
 		      matcher->action_ste.rtc_0 ? matcher->action_ste.rtc_0->id : 0,
 		      ste_0 ? (int)ste_0->id : -1,
 		      matcher->action_ste.rtc_1 ? matcher->action_ste.rtc_1->id : 0,
-		      ste_1 ? (int)ste_1->id : -1);
+		      ste_1 ? (int)ste_1->id : -1,
+		      is_shared && !is_root ?
+		      matcher->match_ste.aliased_rtc_0->id : 0);
 	if (ret < 0)
 		goto out_err;
 
Signature · 1 line
2.31.1
#6 lore raw

PATCH v2 2/5 net/mlx5/hws: change STC array size to 32K

Change STC array size from 16K to 32K.
This change allows supporting more actions
using HWS.

---
 drivers/net/mlx5/hws/mlx5dr_pool.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/mlx5/hws/mlx5dr_pool.h +1 -1
index cd12c3ab9a..4edc4b8c79 100644
@@ -10,7 +10,7 @@ enum mlx5dr_pool_type {
 	MLX5DR_POOL_TYPE_STC,
 };
 
-#define MLX5DR_POOL_STC_LOG_SZ 14
+#define MLX5DR_POOL_STC_LOG_SZ 15
 
 #define MLX5DR_POOL_RESOURCE_ARR_SZ 100
 
Signature · 1 line
2.31.1
#7 lore raw

PATCH v2 3/5 net/mlx5/hws: support STC info dump

In reply to Hamdan Igbaria

Dump the STC info in debug dump.

---
 drivers/net/mlx5/hws/mlx5dr_debug.c | 55 +++++++++++++++++++++++++++++
 drivers/net/mlx5/hws/mlx5dr_debug.h |  1 +
 2 files changed, 56 insertions(+)
drivers/net/mlx5/hws/mlx5dr_debug.c +55 -0
index 4bbdb767ee..6a2644693b 100644
@@ -435,6 +435,57 @@ static int mlx5dr_debug_dump_context_info(FILE *f, struct mlx5dr_context *ctx)
 	return 0;
 }
 
+static int
+mlx5dr_debug_dump_context_stc_resource(FILE *f,
+				       struct mlx5dr_context *ctx,
+				       uint32_t tbl_type,
+				       struct mlx5dr_pool_resource *resource)
+{
+	int ret;
+
+	ret = fprintf(f, "%d,0x%" PRIx64 ",%u,%u\n",
+		      MLX5DR_DEBUG_RES_TYPE_CONTEXT_STC,
+		      (uint64_t)(uintptr_t)ctx,
+		      tbl_type,
+		      resource->base_id);
+	if (ret < 0) {
+		rte_errno = EINVAL;
+		return rte_errno;
+	}
+
+	return 0;
+}
+
+static int mlx5dr_debug_dump_context_stc(FILE *f, struct mlx5dr_context *ctx)
+{
+	struct mlx5dr_pool *stc_pool;
+	int ret;
+	int i;
+
+	for (i = 0; i < MLX5DR_TABLE_TYPE_MAX; i++) {
+		stc_pool = ctx->stc_pool[i];
+
+		if (!stc_pool)
+			continue;
+
+		if (stc_pool->resource[0] != NULL) {
+			ret = mlx5dr_debug_dump_context_stc_resource(f, ctx, i,
+								     stc_pool->resource[0]);
+			if (ret)
+				return ret;
+		}
+
+		if (i == MLX5DR_TABLE_TYPE_FDB && stc_pool->mirror_resource[0] != NULL) {
+			ret = mlx5dr_debug_dump_context_stc_resource(f, ctx, i,
+								     stc_pool->mirror_resource[0]);
+			if (ret)
+				return ret;
+		}
+	}
+
+	return 0;
+}
+
 static int mlx5dr_debug_dump_context(FILE *f, struct mlx5dr_context *ctx)
 {
 	struct mlx5dr_table *tbl;
@@ -448,6 +499,10 @@ static int mlx5dr_debug_dump_context(FILE *f, struct mlx5dr_context *ctx)
 	if (ret)
 		return ret;
 
+	ret = mlx5dr_debug_dump_context_stc(f, ctx);
+	if (ret)
+		return ret;
+
 	LIST_FOREACH(tbl, &ctx->head, next) {
 		ret = mlx5dr_debug_dump_table(f, tbl);
 		if (ret)
drivers/net/mlx5/hws/mlx5dr_debug.h +1 -0
index cf00170f7d..4702ed0ea5 100644
@@ -13,6 +13,7 @@ enum mlx5dr_debug_res_type {
 	MLX5DR_DEBUG_RES_TYPE_CONTEXT_CAPS = 4002,
 	MLX5DR_DEBUG_RES_TYPE_CONTEXT_SEND_ENGINE = 4003,
 	MLX5DR_DEBUG_RES_TYPE_CONTEXT_SEND_RING = 4004,
+	MLX5DR_DEBUG_RES_TYPE_CONTEXT_STC = 4005,
 
 	MLX5DR_DEBUG_RES_TYPE_TABLE = 4100,
 
Signature · 1 line
2.31.1
#8 lore raw

PATCH v2 4/5 net/mlx5/hws: support IP version matching for non relaxed

In reply to Hamdan Igbaria

Enable matching on IP version explicitly for non relaxed mode. This will add support for the user cases where he needs to match on ip version explicitly, for such case to have outer ipv6 and inner ipv4 packets, etc.

---
 drivers/net/mlx5/hws/mlx5dr_definer.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/net/mlx5/hws/mlx5dr_definer.c +16 -0
index 6b98eb8c96..79f4f2667f 100644
@@ -539,6 +539,14 @@ mlx5dr_definer_conv_item_ipv4(struct mlx5dr_definer_conv_data *cd,
 		return rte_errno;
 	}
 
+	if (m->version) {
+		fc = &cd->fc[DR_CALC_FNAME(IP_VERSION, inner)];
+		fc->item_idx = item_idx;
+		fc->tag_set = &mlx5dr_definer_ipv4_version_set;
+		fc->tag_mask_set = &mlx5dr_definer_ones_set;
+		DR_CALC_SET(fc, eth_l2, l3_type, inner);
+	}
+
 	if (m->fragment_offset) {
 		fc = &cd->fc[DR_CALC_FNAME(IP_FRAG, inner)];
 		fc->item_idx = item_idx;
@@ -628,6 +636,14 @@ mlx5dr_definer_conv_item_ipv6(struct mlx5dr_definer_conv_data *cd,
 		DR_CALC_SET(fc, eth_l4, ip_fragmented, inner);
 	}
 
+	if (DR_GET(header_ipv6_vtc, &m->hdr.vtc_flow, version)) {
+		fc = &cd->fc[DR_CALC_FNAME(IP_VERSION, inner)];
+		fc->item_idx = item_idx;
+		fc->tag_set = &mlx5dr_definer_ipv6_version_set;
+		fc->tag_mask_set = &mlx5dr_definer_ones_set;
+		DR_CALC_SET(fc, eth_l2, l3_type, inner);
+	}
+
 	if (DR_GET(header_ipv6_vtc, &m->hdr.vtc_flow, tos)) {
 		fc = &cd->fc[DR_CALC_FNAME(IP_TOS, inner)];
 		fc->item_idx = item_idx;
Signature · 1 line
2.31.1
#9 lore raw

PATCH v2 5/5 net/mlx5: support HW steering debug dump

In reply to Hamdan Igbaria

Add the ability for the DPDK apps to call
HW steering relevant debug data dump function.

---
 drivers/net/mlx5/mlx5_flow.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/net/mlx5/mlx5_flow.c +9 -3
index f5e2831480..a34fcccd2c 100644
@@ -9857,10 +9857,13 @@ mlx5_flow_dev_dump(struct rte_eth_dev *dev, struct rte_flow *flow_idx,
 #ifdef HAVE_IBV_FLOW_DV_SUPPORT
 		if (mlx5_flow_dev_dump_sh_all(dev, file, error))
 			return -EINVAL;
+
+		if (sh->config.dv_flow_en == 2)
+			return mlx5dr_debug_dump(priv->dr_ctx, file);
 #endif
 		return mlx5_devx_cmd_flow_dump(sh->fdb_domain,
-					sh->rx_domain,
-					sh->tx_domain, file);
+					       sh->rx_domain,
+					       sh->tx_domain, file);
 	}
 	/* dump one */
 	flow = mlx5_ipool_get(priv->flows[MLX5_FLOW_TYPE_GEN],
@@ -9878,8 +9881,11 @@ mlx5_flow_dev_dump(struct rte_eth_dev *dev, struct rte_flow *flow_idx,
 		if (!dh)
 			return -ENOENT;
 		if (dh->drv_flow) {
+			if (sh->config.dv_flow_en == 2)
+				return -ENOTSUP;
+
 			ret = mlx5_devx_cmd_flow_single_dump(dh->drv_flow,
-					file);
+							     file);
 			if (ret)
 				return -ENOENT;
 		}
Signature · 1 line
2.31.1
#10 lore raw
In reply to Hamdan Igbaria

From: Hamdan Igbaria

Quoted 8 lines

Fix alias_rtc_0 print location in debug dump, move it to the end of matcher dumped info instead of the middle, to keep the dump compatibility.

Fixes dd2845361a58 ("net/mlx5/hws: add debug details for cross gvmi")
---
 drivers/net/mlx5/hws/mlx5dr_debug.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Looks ok to me.

#11 lore raw
In reply to Hamdan Igbaria

Hi,

Quoted 11 lines

-----Original Message-----
From: Hamdan Igbaria <[email protected]>
Sent: Thursday, February 2, 2023 6:03 PM
To: Hamdan Igbaria <[email protected]>; Slava Ovsiienko <[email protected]>; NBU-Contact-Thomas Monjalon (EXTERNAL) <[email protected]>; Suanming Mou <[email protected]>; Matan Azrad <[email protected]>
Cc: [email protected]; Ori Kam <[email protected]>; Alex Vesker <[email protected]>
Subject: [v2 1/5] net/mlx5/hws: fix alias_rtc_0 print location in debug dump

Quoted 5 lines

Fix alias_rtc_0 print location in debug dump, move it to the end of matcher dumped info instead of the middle, to keep the dump compatibility.

Fixes dd2845361a58 ("net/mlx5/hws: add debug details for cross gvmi")

Series applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh