mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-06-01 22:12:42 -04:00
RDMA/bng_re: Add basic debugfs infrastructure
Add basic debugfs infrastructure for Broadcom next generation controller. Signed-off-by: Siva Reddy Kallam <siva.kallam@broadcom.com> Link: https://patch.msgid.link/20251117171136.128193-8-siva.kallam@broadcom.com Reviewed-by: Usman Ansari <usman.ansari@broadcom.com> Signed-off-by: Leon Romanovsky <leon@kernel.org>
This commit is contained in:
committed by
Leon Romanovsky
parent
53c6ee7d7f
commit
99e4e10283
@@ -4,4 +4,5 @@ ccflags-y := -I $(srctree)/drivers/net/ethernet/broadcom/bnge -I $(srctree)/driv
|
||||
obj-$(CONFIG_INFINIBAND_BNG_RE) += bng_re.o
|
||||
|
||||
bng_re-y := bng_dev.o bng_fw.o \
|
||||
bng_res.o bng_sp.o
|
||||
bng_res.o bng_sp.o \
|
||||
bng_debugfs.o
|
||||
|
||||
39
drivers/infiniband/hw/bng_re/bng_debugfs.c
Normal file
39
drivers/infiniband/hw/bng_re/bng_debugfs.c
Normal file
@@ -0,0 +1,39 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
// Copyright (c) 2025 Broadcom.
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/pci.h>
|
||||
|
||||
#include <rdma/ib_verbs.h>
|
||||
|
||||
#include "bng_res.h"
|
||||
#include "bng_fw.h"
|
||||
#include "bnge.h"
|
||||
#include "bnge_auxr.h"
|
||||
#include "bng_re.h"
|
||||
#include "bng_debugfs.h"
|
||||
|
||||
static struct dentry *bng_re_debugfs_root;
|
||||
|
||||
void bng_re_debugfs_add_pdev(struct bng_re_dev *rdev)
|
||||
{
|
||||
struct pci_dev *pdev = rdev->aux_dev->pdev;
|
||||
|
||||
rdev->dbg_root =
|
||||
debugfs_create_dir(dev_name(&pdev->dev), bng_re_debugfs_root);
|
||||
}
|
||||
|
||||
void bng_re_debugfs_rem_pdev(struct bng_re_dev *rdev)
|
||||
{
|
||||
debugfs_remove_recursive(rdev->dbg_root);
|
||||
rdev->dbg_root = NULL;
|
||||
}
|
||||
|
||||
void bng_re_register_debugfs(void)
|
||||
{
|
||||
bng_re_debugfs_root = debugfs_create_dir("bng_re", NULL);
|
||||
}
|
||||
|
||||
void bng_re_unregister_debugfs(void)
|
||||
{
|
||||
debugfs_remove(bng_re_debugfs_root);
|
||||
}
|
||||
12
drivers/infiniband/hw/bng_re/bng_debugfs.h
Normal file
12
drivers/infiniband/hw/bng_re/bng_debugfs.h
Normal file
@@ -0,0 +1,12 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
// Copyright (c) 2025 Broadcom.
|
||||
|
||||
#ifndef __BNG_RE_DEBUGFS__
|
||||
#define __BNG_RE_DEBUGFS__
|
||||
|
||||
void bng_re_debugfs_add_pdev(struct bng_re_dev *rdev);
|
||||
void bng_re_debugfs_rem_pdev(struct bng_re_dev *rdev);
|
||||
|
||||
void bng_re_register_debugfs(void);
|
||||
void bng_re_unregister_debugfs(void);
|
||||
#endif
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "bnge_auxr.h"
|
||||
#include "bng_re.h"
|
||||
#include "bnge_hwrm.h"
|
||||
#include "bng_debugfs.h"
|
||||
|
||||
MODULE_AUTHOR("Siva Reddy Kallam <siva.kallam@broadcom.com>");
|
||||
MODULE_DESCRIPTION(BNG_RE_DESC);
|
||||
@@ -215,6 +216,7 @@ static void bng_re_query_hwrm_version(struct bng_re_dev *rdev)
|
||||
|
||||
static void bng_re_dev_uninit(struct bng_re_dev *rdev)
|
||||
{
|
||||
bng_re_debugfs_rem_pdev(rdev);
|
||||
bng_re_disable_rcfw_channel(&rdev->rcfw);
|
||||
bng_re_net_ring_free(rdev, rdev->rcfw.creq.ring_id,
|
||||
RING_ALLOC_REQ_RING_TYPE_NQ);
|
||||
@@ -314,6 +316,9 @@ static int bng_re_dev_init(struct bng_re_dev *rdev)
|
||||
rc = bng_re_get_dev_attr(&rdev->rcfw);
|
||||
if (rc)
|
||||
goto disable_rcfw;
|
||||
|
||||
bng_re_debugfs_add_pdev(rdev);
|
||||
|
||||
return 0;
|
||||
disable_rcfw:
|
||||
bng_re_disable_rcfw_channel(&rdev->rcfw);
|
||||
@@ -419,17 +424,24 @@ static int __init bng_re_mod_init(void)
|
||||
int rc;
|
||||
|
||||
|
||||
bng_re_register_debugfs();
|
||||
|
||||
rc = auxiliary_driver_register(&bng_re_driver);
|
||||
if (rc) {
|
||||
pr_err("%s: Failed to register auxiliary driver\n",
|
||||
KBUILD_MODNAME);
|
||||
goto unreg_debugfs;
|
||||
}
|
||||
return 0;
|
||||
unreg_debugfs:
|
||||
bng_re_unregister_debugfs();
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void __exit bng_re_mod_exit(void)
|
||||
{
|
||||
auxiliary_driver_unregister(&bng_re_driver);
|
||||
bng_re_unregister_debugfs();
|
||||
}
|
||||
|
||||
module_init(bng_re_mod_init);
|
||||
|
||||
@@ -75,6 +75,7 @@ struct bng_re_dev {
|
||||
struct bng_re_nq_record *nqr;
|
||||
/* Device Resources */
|
||||
struct bng_re_dev_attr *dev_attr;
|
||||
struct dentry *dbg_root;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user