Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Selvin Xavier <selvin.xavier@broadcom.com>
To: leon@kernel.org, jgg@ziepe.ca
Cc: linux-rdma@vger.kernel.org, andrew.gospodarek@broadcom.com,
	kalesh-anakkur.purayil@broadcom.com, netdev@vger.kernel.org,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	abeni@redhat.com, horms@kernel.org, michael.chan@broadcom.com,
	Selvin Xavier <selvin.xavier@broadcom.com>
Subject: [PATCH rdma-next 6/9] RDMA/bnxt_re: Support the dump infrastructure
Date: Thu, 20 Feb 2025 10:34:53 -0800	[thread overview]
Message-ID: <1740076496-14227-7-git-send-email-selvin.xavier@broadcom.com> (raw)
In-Reply-To: <1740076496-14227-1-git-send-email-selvin.xavier@broadcom.com>

From: Michael Chan <michael.chan@broadcom.com>

Adds the stubs for the debug dump in bnxt_re
driver.
Each segment of the dump data holds a particalar resource
type. get_dump_info returns the number of segments and the size
of each segments. Driver currently supports segments for
QP/CQ/SRQ/MR and for the generic host logs.

While taking the dump, get_dump_data will be invoked for each
of the segments and bnxt_re driver returns the data associated
with each segment.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
---
 drivers/infiniband/hw/bnxt_re/main.c | 85 +++++++++++++++++++++++++++++++++++-
 1 file changed, 84 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c
index 6b5a169..76dd0fa 100644
--- a/drivers/infiniband/hw/bnxt_re/main.c
+++ b/drivers/infiniband/hw/bnxt_re/main.c
@@ -497,10 +497,93 @@ static void bnxt_re_start_irq(void *handle, struct bnxt_msix_entry *ent)
 	}
 }
 
+#define BNXT_SEGMENT_ROCE	255
+#define BNXT_SEGMENT_QP_CTX	256
+#define BNXT_SEGMENT_SRQ_CTX	257
+#define BNXT_SEGMENT_CQ_CTX	258
+#define BNXT_SEGMENT_MR_CTX	270
+
+static void bnxt_re_dump_ctx(struct bnxt_re_dev *rdev, u32 seg_id, void *buf,
+			     u32 buf_len)
+{
+}
+
+/* bnxt_re_snapdump - Collect RoCE debug data for coredump.
+ * @rdev	-   rdma device instance
+ * @buf		-	Pointer to dump buffer
+ * @buf_len	-	Buffer length
+ *
+ * This function will dump RoCE debug data to the coredump.
+ *
+ * Returns: Nothing
+ *
+ */
+static void bnxt_re_snapdump(struct bnxt_re_dev *rdev, void *buf, u32 buf_len)
+{
+}
+
+#define BNXT_RE_TRACE_DUMP_SIZE	0x2000000
+
+/* bnxt_re_get_dump_info - ULP callback from L2 driver to collect dump info
+ * @handle	- en_dev information. L2 and RoCE device information
+ * @dump_flags	- ethtool dump flags
+ * @dump	- ulp structure containing all coredump segment info
+ *
+ * This function is the callback from the L2 driver to provide the list of
+ * dump segments for the ethtool coredump.
+ *
+ * Returns: Nothing
+ *
+ */
+static void bnxt_re_get_dump_info(void *handle, u32 dump_flags,
+				  struct bnxt_ulp_dump *dump)
+{
+	struct bnxt_re_en_dev_info *en_info = auxiliary_get_drvdata(handle);
+	struct bnxt_ulp_dump_tbl *tbl = dump->seg_tbl;
+	struct bnxt_re_dev *rdev = en_info->rdev;
+
+	dump->segs = 5;
+	tbl[0].seg_id = BNXT_SEGMENT_QP_CTX;
+	tbl[0].seg_len = rdev->rcfw.qp_ctxm_size * BNXT_RE_MAX_QDUMP_ENTRIES;
+	tbl[1].seg_id = BNXT_SEGMENT_CQ_CTX;
+	tbl[1].seg_len = rdev->rcfw.cq_ctxm_size * BNXT_RE_MAX_QDUMP_ENTRIES;
+	tbl[2].seg_id = BNXT_SEGMENT_MR_CTX;
+	tbl[2].seg_len = rdev->rcfw.mrw_ctxm_size * BNXT_RE_MAX_QDUMP_ENTRIES;
+	tbl[3].seg_id = BNXT_SEGMENT_SRQ_CTX;
+	tbl[3].seg_len = rdev->rcfw.srq_ctxm_size * BNXT_RE_MAX_QDUMP_ENTRIES;
+	tbl[4].seg_id = BNXT_SEGMENT_ROCE;
+	tbl[4].seg_len = BNXT_RE_TRACE_DUMP_SIZE;
+}
+
+/* bnxt_re_get_dump_data - ULP callback from L2 driver to collect dump data
+ * @handle	- en_dev information. L2 and RoCE device information
+ * @seg_id	- segment ID of the dump
+ * @buf		- dump buffer pointer
+ * @len		- length of the buffer
+ *
+ * This function is the callback from the L2 driver to fill the buffer with
+ * coredump data for each segment.
+ *
+ * Returns: Nothing
+ *
+ */
+static void bnxt_re_get_dump_data(void *handle, u32 seg_id, void *buf, u32 len)
+{
+	struct bnxt_re_en_dev_info *en_info = auxiliary_get_drvdata(handle);
+	struct bnxt_re_dev *rdev = en_info->rdev;
+
+	if (seg_id == BNXT_SEGMENT_ROCE)
+		return bnxt_re_snapdump(rdev, buf, len);
+
+	bnxt_re_dump_ctx(rdev, seg_id, buf, len);
+}
+
 static struct bnxt_ulp_ops bnxt_re_ulp_ops = {
 	.ulp_async_notifier = bnxt_re_async_notifier,
 	.ulp_irq_stop = bnxt_re_stop_irq,
-	.ulp_irq_restart = bnxt_re_start_irq
+	.ulp_irq_restart = bnxt_re_start_irq,
+	.ulp_get_dump_info = bnxt_re_get_dump_info,
+	.ulp_get_dump_data = bnxt_re_get_dump_data,
 };
 
 /* RoCE -> Net driver */
-- 
2.5.5


  parent reply	other threads:[~2025-02-20 18:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-20 18:34 [PATCH rdma-next 0/9] RDMA/bnxt_re: Driver Debug Enhancements Selvin Xavier
2025-02-20 18:34 ` [PATCH rdma-next 1/9] RDMA/bnxt_re: Add support for collecting the Queue dumps Selvin Xavier
2025-02-20 18:34 ` [PATCH rdma-next 2/9] RDMA/bnxt_re: Cache the QP information Selvin Xavier
2025-02-20 18:34 ` [PATCH rdma-next 3/9] RDMA/bnxt_re : Initialize the HW context dump collection Selvin Xavier
2025-02-20 18:34 ` [PATCH rdma-next 4/9] RDMA/bnxt_re: Get the resource contexts from the HW Selvin Xavier
2025-02-20 18:34 ` [PATCH rdma-next 5/9] bnxt_en: Introduce ULP coredump callbacks Selvin Xavier
2025-02-22  0:40   ` Jakub Kicinski
2025-02-20 18:34 ` Selvin Xavier [this message]
2025-02-20 18:34 ` [PATCH rdma-next 7/9] RDMA/bnxt_re: Dump the debug information in snapdump Selvin Xavier
2025-02-20 18:34 ` [PATCH rdma-next 8/9] RDMA/bnxt_re: Dump the HW context information Selvin Xavier
2025-02-20 18:34 ` [PATCH rdma-next 9/9] RDMA/bnxt_re: Add support for changing the snap dump level Selvin Xavier
2025-02-23 13:34 ` [PATCH rdma-next 0/9] RDMA/bnxt_re: Driver Debug Enhancements Leon Romanovsky
2025-02-24  9:00   ` Selvin Xavier
2025-04-01 13:41     ` Jason Gunthorpe
2025-04-01 20:48       ` Andy Gospodarek

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=1740076496-14227-7-git-send-email-selvin.xavier@broadcom.com \
    --to=selvin.xavier@broadcom.com \
    --cc=abeni@redhat.com \
    --cc=andrew.gospodarek@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=kalesh-anakkur.purayil@broadcom.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    /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