DPDK patches and discussions
 help / color / mirror / Atom feed
From: Hamdan Igbaria <hamdani@nvidia.com>
To: <hamdani@nvidia.com>, <viacheslavo@nvidia.com>,
	<thomas@monjalon.net>, <suanmingm@nvidia.com>,
	Matan Azrad <matan@nvidia.com>
Cc: <dev@dpdk.org>, <orika@nvidia.com>, <valex@nvidia.com>
Subject: [PATCH 3/5] net/mlx5/hws: support STC info dump
Date: Thu, 26 Jan 2023 18:03:07 +0200	[thread overview]
Message-ID: <20230126160309.584967-3-hamdani@nvidia.com> (raw)
In-Reply-To: <20230126160309.584967-1-hamdani@nvidia.com>

Dump the STC info in debug dump.

Signed-off-by: Hamdan Igbaria <hamdani@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr_debug.c | 55 +++++++++++++++++++++++++++++
 drivers/net/mlx5/hws/mlx5dr_debug.h |  1 +
 2 files changed, 56 insertions(+)

diff --git a/drivers/net/mlx5/hws/mlx5dr_debug.c b/drivers/net/mlx5/hws/mlx5dr_debug.c
index 4bbdb767ee..6a2644693b 100644
--- a/drivers/net/mlx5/hws/mlx5dr_debug.c
+++ b/drivers/net/mlx5/hws/mlx5dr_debug.c
@@ -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)
diff --git a/drivers/net/mlx5/hws/mlx5dr_debug.h b/drivers/net/mlx5/hws/mlx5dr_debug.h
index cf00170f7d..4702ed0ea5 100644
--- a/drivers/net/mlx5/hws/mlx5dr_debug.h
+++ b/drivers/net/mlx5/hws/mlx5dr_debug.h
@@ -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,
 
-- 
2.31.1


  parent reply	other threads:[~2023-01-26 16:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-26 16:03 [PATCH 1/5] net/mlx5/hws: fix alias_rtc_0 print location in debug dump Hamdan Igbaria
2023-01-26 16:03 ` [PATCH 2/5] net/mlx5/hws: change STC array size to 32K Hamdan Igbaria
2023-01-26 16:03 ` Hamdan Igbaria [this message]
2023-01-26 16:03 ` [PATCH 4/5] net/mlx5/hws: support IP version matching for non relaxed Hamdan Igbaria
2023-01-26 16:03 ` [PATCH 5/5] net/mlx5: support HW steering debug dump Hamdan Igbaria
2023-02-02 16:02 ` [v2 1/5] net/mlx5/hws: fix alias_rtc_0 print location in " Hamdan Igbaria
2023-02-02 16:02   ` [v2 2/5] net/mlx5/hws: change STC array size to 32K Hamdan Igbaria
2023-02-02 16:02   ` [v2 3/5] net/mlx5/hws: support STC info dump Hamdan Igbaria
2023-02-02 16:02   ` [v2 4/5] net/mlx5/hws: support IP version matching for non relaxed Hamdan Igbaria
2023-02-02 16:02   ` [v2 5/5] net/mlx5: support HW steering debug dump Hamdan Igbaria
2023-02-12 11:50   ` [v2 1/5] net/mlx5/hws: fix alias_rtc_0 print location in " Matan Azrad
2023-02-14  8:28   ` Raslan Darawsheh

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=20230126160309.584967-3-hamdani@nvidia.com \
    --to=hamdani@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=matan@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=suanmingm@nvidia.com \
    --cc=thomas@monjalon.net \
    --cc=valex@nvidia.com \
    --cc=viacheslavo@nvidia.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).