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 9/9] RDMA/bnxt_re: Add support for changing the snap dump level
Date: Thu, 20 Feb 2025 10:34:56 -0800	[thread overview]
Message-ID: <1740076496-14227-10-git-send-email-selvin.xavier@broadcom.com> (raw)
In-Reply-To: <1740076496-14227-1-git-send-email-selvin.xavier@broadcom.com>

Add support for changing the default debug dump level.

Reviewed-by: Saravanan Vajravel <saravanan.vajravel@broadcom.com>
Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
---
 drivers/infiniband/hw/bnxt_re/bnxt_re.h |  2 ++
 drivers/infiniband/hw/bnxt_re/debugfs.c | 49 +++++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+)

diff --git a/drivers/infiniband/hw/bnxt_re/bnxt_re.h b/drivers/infiniband/hw/bnxt_re/bnxt_re.h
index 45601635..45d62f6 100644
--- a/drivers/infiniband/hw/bnxt_re/bnxt_re.h
+++ b/drivers/infiniband/hw/bnxt_re/bnxt_re.h
@@ -304,6 +304,8 @@ struct bnxt_re_dev {
 	struct workqueue_struct		*dcb_wq;
 	/* Head to track all QP dump */
 	struct bnxt_re_qdump_head qdump_head;
+	struct dentry                   *tunables;
+	struct dentry                   *snapdump_dbg;
 	u8 snapdump_dbg_lvl;
 	struct dentry                   *cc_config;
 	struct bnxt_re_dbg_cc_config_params *cc_config_params;
diff --git a/drivers/infiniband/hw/bnxt_re/debugfs.c b/drivers/infiniband/hw/bnxt_re/debugfs.c
index af91d16..e3fba53 100644
--- a/drivers/infiniband/hw/bnxt_re/debugfs.c
+++ b/drivers/infiniband/hw/bnxt_re/debugfs.c
@@ -306,6 +306,52 @@ static const struct file_operations bnxt_re_cc_config_ops = {
 	.write = bnxt_re_cc_config_set,
 };
 
+static ssize_t bnxt_re_snapdump_dbg_lvl_set(struct file *filp, const char __user *buffer,
+					    size_t count, loff_t *ppos)
+{
+	struct bnxt_re_dev *rdev = filp->private_data;
+	char buf[16];
+	u32 val;
+
+	if (count >= sizeof(buf))
+		return -EINVAL;
+
+	if (copy_from_user(buf, buffer, count))
+		return -EFAULT;
+
+	buf[count] = '\0';
+	if (kstrtou32(buf, 0, &val))
+		return -EINVAL;
+
+	if (val > BNXT_RE_SNAPDUMP_ALL)
+		return -EINVAL;
+
+	rdev->snapdump_dbg_lvl = val;
+
+	return count;
+}
+
+static ssize_t bnxt_re_snapdump_dbg_lvl_get(struct file *filp, char __user *buffer,
+					    size_t usr_buf_len, loff_t *ppos)
+{
+	struct bnxt_re_dev *rdev = filp->private_data;
+	char buf[16];
+	int rc;
+
+	rc = snprintf(buf, sizeof(buf), "%d\n", rdev->snapdump_dbg_lvl);
+	if (rc < 0)
+		return rc;
+
+	return simple_read_from_buffer(buffer, usr_buf_len, ppos, (u8 *)(buf), rc);
+}
+
+static const struct file_operations bnxt_re_snapdump_dbg_lvl = {
+	.owner = THIS_MODULE,
+	.open = simple_open,
+	.read = bnxt_re_snapdump_dbg_lvl_get,
+	.write = bnxt_re_snapdump_dbg_lvl_set,
+};
+
 void bnxt_re_debugfs_add_pdev(struct bnxt_re_dev *rdev)
 {
 	struct pci_dev *pdev = rdev->en_dev->pdev;
@@ -329,6 +375,9 @@ void bnxt_re_debugfs_add_pdev(struct bnxt_re_dev *rdev)
 							 rdev->cc_config, tmp_params,
 							 &bnxt_re_cc_config_ops);
 	}
+	rdev->tunables = debugfs_create_dir("tunables", rdev->dbg_root);
+	rdev->snapdump_dbg = debugfs_create_file("snapdump_dbg_lvl", 0400,  rdev->tunables, rdev,
+						 &bnxt_re_snapdump_dbg_lvl);
 }
 
 void bnxt_re_debugfs_rem_pdev(struct bnxt_re_dev *rdev)
-- 
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 ` [PATCH rdma-next 6/9] RDMA/bnxt_re: Support the dump infrastructure Selvin Xavier
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 ` Selvin Xavier [this message]
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-10-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