RDMA/bnxt_re: Debug enhancements for bnxt_re driver
Subsystems (2)
Selvin Xavier
maintainerv2 cover RDMA/bnxt_re: Debug enhancements for bnxt_re driver
This series is the first set that enables few debug options in bnxt_re driver. Implements the basic driver data collection using the rdma tool. Also, implements raw data query option to get some of the Hardware specific information for analysis. Added a debugfs folder for bnxt_re corresponding to each PCI device to display some of the driver specific information. This will be enhanced in future series.
Please review and apply.
Thanks,
Selvin Xavier
v1 - v2 :
- Remove the unnecessary user/kernel text displayed in dump output
- Avoid unnecessary NULL check while deleting the debugfs directory
Kalesh AP (1):
RDMA/bnxt_re: Add debugfs hook in the driver
Kashyap Desai (3):
RDMA/bnxt_re: Support driver specific data collection using rdma tool RDMA/bnxt_re: Add support for querying HW contexts RDMA/bnxt_re: Support raw data query for each resources
drivers/infiniband/hw/bnxt_re/Makefile | 3 +- drivers/infiniband/hw/bnxt_re/bnxt_re.h | 21 +++ drivers/infiniband/hw/bnxt_re/debugfs.c | 138 +++++++++++++++ drivers/infiniband/hw/bnxt_re/debugfs.h | 21 +++ drivers/infiniband/hw/bnxt_re/ib_verbs.c | 4 + drivers/infiniband/hw/bnxt_re/ib_verbs.h | 1 + drivers/infiniband/hw/bnxt_re/main.c | 272 ++++++++++++++++++++++++++++- drivers/infiniband/hw/bnxt_re/qplib_rcfw.h | 2 + drivers/infiniband/hw/bnxt_re/qplib_sp.c | 35 ++++ drivers/infiniband/hw/bnxt_re/qplib_sp.h | 2 + drivers/infiniband/hw/bnxt_re/roce_hsi.h | 40 +++++ 11 files changed, 537 insertions(+), 2 deletions(-) create mode 100644 drivers/infiniband/hw/bnxt_re/debugfs.c create mode 100644 drivers/infiniband/hw/bnxt_re/debugfs.h
Signature · 1 line
2.5.5
Selvin Xavier
maintainerPATCH v2 1/4 RDMA/bnxt_re: Support driver specific data collection using rdma tool
From: Kashyap Desai <[email protected]>
Allow users to dump driver specific resource details when queried through rdma tool. This supports the driver data for QP, CQ, MR and SRQ.
---
v1 - v2 :
- Remove the unnecessary user/kernel text displayed in dump output
drivers/infiniband/hw/bnxt_re/main.c | 141 +++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+)
drivers/infiniband/hw/bnxt_re/main.c +141 -0
@@ -870,6 +870,139 @@ static const struct attribute_group bnxt_re_dev_attr_group = { .attrs = bnxt_re_attributes, }; +static int bnxt_re_fill_res_mr_entry (struct sk_buff *msg,struct ib_mr *ib_mr) +{ +struct bnxt_qplib_hwq *mr_hwq; +struct nlattr *table_attr; +struct bnxt_re_mr *mr; + + table_attr =nla_nest_start (msg,RDMA_NLDEV_ATTR_DRIVER ); +if (!table_attr) +return -EMSGSIZE ; + + mr = container_of(ib_mr, struct bnxt_re_mr, ib_mr); + mr_hwq = &mr->qplib_mr.hwq; + +if (rdma_nl_put_driver_u32 (msg,"page_size" , + mr_hwq->qe_ppg * mr_hwq->element_size)) + goto err; +if (rdma_nl_put_driver_u32 (msg,"max_elements" , mr_hwq->max_elements)) + goto err; +if (rdma_nl_put_driver_u32 (msg,"element_size" , mr_hwq->element_size)) + goto err; +if (rdma_nl_put_driver_u64_hex (msg,"hwq" , (unsigned long )mr_hwq)) + goto err; +if (rdma_nl_put_driver_u64_hex (msg,"va" , mr->qplib_mr.va)) + goto err; + +nla_nest_end (msg, table_attr); +return 0 ; + +err: +nla_nest_cancel (msg, table_attr); +return -EMSGSIZE ; +} + +static int bnxt_re_fill_res_cq_entry (struct sk_buff *msg,struct ib_cq *ib_cq) +{ +struct bnxt_qplib_hwq *cq_hwq; +struct nlattr *table_attr; +struct bnxt_re_cq *cq; + + cq = container_of(ib_cq, struct bnxt_re_cq, ib_cq); + cq_hwq = &cq->qplib_cq.hwq; + + table_attr =nla_nest_start (msg,RDMA_NLDEV_ATTR_DRIVER ); +if (!table_attr) +return -EMSGSIZE ; + +if (rdma_nl_put_driver_u32 (msg,"cq_depth" , cq_hwq->depth)) + goto err; +if (rdma_nl_put_driver_u32 (msg,"max_elements" , cq_hwq->max_elements)) + goto err; +if (rdma_nl_put_driver_u32 (msg,"element_size" , cq_hwq->element_size)) + goto err; +if (rdma_nl_put_driver_u32 (msg,"max_wqe" , cq->qplib_cq.max_wqe)) + goto err; + +nla_nest_end (msg, table_attr); +return 0 ; + +err: +nla_nest_cancel (msg, table_attr); +return -EMSGSIZE ; +} + +static int bnxt_re_fill_res_qp_entry (struct sk_buff *msg,struct ib_qp *ib_qp) +{ +struct bnxt_qplib_qp *qplib_qp; +struct nlattr *table_attr; +struct bnxt_re_qp *qp; + + table_attr =nla_nest_start (msg,RDMA_NLDEV_ATTR_DRIVER ); +if (!table_attr) +return -EMSGSIZE ; + + qp = container_of(ib_qp, struct bnxt_re_qp, ib_qp); + qplib_qp = &qp->qplib_qp; + +if (rdma_nl_put_driver_u32 (msg,"sq_max_wqe" , qplib_qp->sq.max_wqe)) + goto err; +if (rdma_nl_put_driver_u32 (msg,"sq_max_sge" , qplib_qp->sq.max_sge)) + goto err; +if (rdma_nl_put_driver_u32 (msg,"sq_wqe_size" , qplib_qp->sq.wqe_size)) + goto err; +if (rdma_nl_put_driver_u32 (msg,"sq_swq_start" , qplib_qp->sq.swq_start)) + goto err; +if (rdma_nl_put_driver_u32 (msg,"sq_swq_last" , qplib_qp->sq.swq_last)) + goto err; +if (rdma_nl_put_driver_u32 (msg,"rq_max_wqe" , qplib_qp->rq.max_wqe)) + goto err; +if (rdma_nl_put_driver_u32 (msg,"rq_max_sge" , qplib_qp->rq.max_sge)) + goto err; +if (rdma_nl_put_driver_u32 (msg,"rq_wqe_size" , qplib_qp->rq.wqe_size)) + goto err; +if (rdma_nl_put_driver_u32 (msg,"rq_swq_start" , qplib_qp->rq.swq_start)) + goto err; +if (rdma_nl_put_driver_u32 (msg,"rq_swq_last" , qplib_qp->rq.swq_last)) + goto err; +if (rdma_nl_put_driver_u32 (msg,"timeout" , qplib_qp->timeout)) + goto err; + +nla_nest_end (msg, table_attr); +return 0 ; + +err: +nla_nest_cancel (msg, table_attr); +return -EMSGSIZE ; +} + +static int bnxt_re_fill_res_srq_entry (struct sk_buff *msg,struct ib_srq *ib_srq) +{ +struct nlattr *table_attr; +struct bnxt_re_srq *srq; + + table_attr =nla_nest_start (msg,RDMA_NLDEV_ATTR_DRIVER ); +if (!table_attr) +return -EMSGSIZE ; + + srq = container_of(ib_srq, struct bnxt_re_srq, ib_srq); + +if (rdma_nl_put_driver_u32_hex (msg,"wqe_size" , srq->qplib_srq.wqe_size)) + goto err; +if (rdma_nl_put_driver_u32_hex (msg,"max_wqe" , srq->qplib_srq.max_wqe)) + goto err; +if (rdma_nl_put_driver_u32_hex (msg,"max_sge" , srq->qplib_srq.max_sge)) + goto err; + +nla_nest_end (msg, table_attr); +return 0 ; + +err: +nla_nest_cancel (msg, table_attr); +return -EMSGSIZE ; +} +static const struct ib_device_ops bnxt_re_dev_ops = { .owner =THIS_MODULE , .driver_id =RDMA_DRIVER_BNXT_RE ,
@@ -928,6 +1061,13 @@ static const struct ib_device_ops bnxt_re_dev_ops = { INIT_RDMA_OBJ_SIZE(ib_ucontext, bnxt_re_ucontext, ib_uctx), }; +static const struct ib_device_ops restrack_ops = { + .fill_res_cq_entry = bnxt_re_fill_res_cq_entry, + .fill_res_qp_entry = bnxt_re_fill_res_qp_entry, + .fill_res_mr_entry = bnxt_re_fill_res_mr_entry, + .fill_res_srq_entry = bnxt_re_fill_res_srq_entry, +}; +static int bnxt_re_register_ib (struct bnxt_re_dev *rdev) {struct ib_device *ibdev = &rdev->ibdev;
@@ -949,6 +1089,7 @@ static int bnxt_re_register_ib(struct bnxt_re_dev *rdev) ibdev->driver_def = bnxt_re_uapi_defs;ib_set_device_ops (ibdev, &bnxt_re_dev_ops); +ib_set_device_ops (ibdev, &restrack_ops); ret =ib_device_set_netdev (&rdev->ibdev, rdev->netdev,1 );if (ret)return ret;
Signature · 1 line
2.5.5
Selvin Xavier
maintainerPATCH v2 2/4 RDMA/bnxt_re: Add support for querying HW contexts
In reply to Selvin XavierFrom: Kashyap Desai <[email protected]>
Implements support for querying the hardware resource contexts. This raw data can be used for the debugging of the field issues.
--- drivers/infiniband/hw/bnxt_re/bnxt_re.h | 19 ++++++++++++++ drivers/infiniband/hw/bnxt_re/qplib_rcfw.h | 2 ++ drivers/infiniband/hw/bnxt_re/qplib_sp.c | 35 ++++++++++++++++++++++++++ drivers/infiniband/hw/bnxt_re/qplib_sp.h | 2 ++ drivers/infiniband/hw/bnxt_re/roce_hsi.h | 40 ++++++++++++++++++++++++++++++ 5 files changed, 98 insertions(+)
drivers/infiniband/hw/bnxt_re/bnxt_re.h +19 -0
@@ -247,4 +247,23 @@ static inline void bnxt_re_set_pacing_dev_state(struct bnxt_re_dev *rdev) rdev->qplib_res.pacing_data->dev_err_state = test_bit(BNXT_RE_FLAG_ERR_DEVICE_DETACHED, &rdev->flags); } + +static inline int bnxt_re_read_context_allowed (struct bnxt_re_dev *rdev) +{ +if (!bnxt_qplib_is_chip_gen_p5_p7 (rdev->chip_ctx) || + rdev->rcfw.res->cctx->hwrm_intf_ver <HWRM_VERSION_READ_CTX ) +return -EOPNOTSUPP ; +return 0 ; +} + +#define BNXT_RE_CONTEXT_TYPE_QPC_SIZE_P5 1088 +#define BNXT_RE_CONTEXT_TYPE_CQ_SIZE_P5 128 +#define BNXT_RE_CONTEXT_TYPE_MRW_SIZE_P5 128 +#define BNXT_RE_CONTEXT_TYPE_SRQ_SIZE_P5 192 + +#define BNXT_RE_CONTEXT_TYPE_QPC_SIZE_P7 1088 +#define BNXT_RE_CONTEXT_TYPE_CQ_SIZE_P7 192 +#define BNXT_RE_CONTEXT_TYPE_MRW_SIZE_P7 192 +#define BNXT_RE_CONTEXT_TYPE_SRQ_SIZE_P7 192 +#endif
drivers/infiniband/hw/bnxt_re/qplib_rcfw.h +2 -0
@@ -131,6 +131,8 @@ static inline u32 bnxt_qplib_set_cmd_slots(struct cmdq_base *req)#define RCFW_CMD_IS_BLOCKING 0x8000#define HWRM_VERSION_DEV_ATTR_MAX_DPI 0x1000A0000000DULL +/* HWRM version 1.10.3.18 */ +#define HWRM_VERSION_READ_CTX 0x1000A00030012/* Crsq buf is 1024-Byte */ struct bnxt_qplib_crsbe {
drivers/infiniband/hw/bnxt_re/qplib_sp.c +35 -0
@@ -972,3 +972,38 @@ int bnxt_qplib_modify_cc(struct bnxt_qplib_res *res, rc =bnxt_qplib_rcfw_send_message (res->rcfw, &msg);return rc; } + +int bnxt_qplib_read_context (struct bnxt_qplib_rcfw *rcfw,u8 res_type, +u32 xid,u32 resp_size,void *resp_va) +{ +struct creq_read_context resp = {}; +struct bnxt_qplib_cmdqmsg msg = {}; +struct cmdq_read_context req = {}; +struct bnxt_qplib_rcfw_sbuf sbuf; +int rc; + + sbuf.size = resp_size; + sbuf.sb =dma_alloc_coherent (&rcfw->pdev->dev, sbuf.size, + &sbuf.dma_addr,GFP_KERNEL ); +if (!sbuf.sb) +return -ENOMEM ; + +bnxt_qplib_rcfw_cmd_prep ((struct cmdq_base *)&req, +CMDQ_BASE_OPCODE_READ_CONTEXT ,sizeof (req)); + req.resp_addr =cpu_to_le64 (sbuf.dma_addr); + req.resp_size = resp_size /BNXT_QPLIB_CMDQE_UNITS ; + + req.xid =cpu_to_le32 (xid); + req.type = res_type; + +bnxt_qplib_fill_cmdqmsg (&msg, &req, &resp, &sbuf,sizeof (req), +sizeof (resp),0 ); + rc =bnxt_qplib_rcfw_send_message (rcfw, &msg); +if (rc) + goto free_mem; + +memcpy (resp_va, sbuf.sb, resp_size); +free_mem: +dma_free_coherent (&rcfw->pdev->dev, sbuf.size, sbuf.sb, sbuf.dma_addr); +return rc; +}
drivers/infiniband/hw/bnxt_re/qplib_sp.h +2 -0
@@ -352,6 +352,8 @@ int bnxt_qplib_qext_stat(struct bnxt_qplib_rcfw *rcfw, u32 fid, struct bnxt_qplib_ext_stat *estat);int bnxt_qplib_modify_cc (struct bnxt_qplib_res *res,struct bnxt_qplib_cc_param *cc_param); +int bnxt_qplib_read_context (struct bnxt_qplib_rcfw *rcfw,u8 type,u32 xid, +u32 resp_size,void *resp_va);#define BNXT_VAR_MAX_WQE 4352#define BNXT_VAR_MAX_SLOT_ALIGN 256
drivers/infiniband/hw/bnxt_re/roce_hsi.h +40 -0
@@ -2265,6 +2265,46 @@ struct creq_set_func_resources_resp {u8 reserved48[6 ]; }; +/* cmdq_read_context (size:192b/24B) */ +struct cmdq_read_context { +u8 opcode; +#define CMDQ_READ_CONTEXT_OPCODE_READ_CONTEXT 0x85UL +#define CMDQ_READ_CONTEXT_OPCODE_LAST CMDQ_READ_CONTEXT_OPCODE_READ_CONTEXT +u8 cmd_size; +__le16 flags; +__le16 cookie; +u8 resp_size; +u8 reserved8; +__le64 resp_addr; +__le32 xid; +u8 type; +#define CMDQ_READ_CONTEXT_TYPE_QPC 0x0UL +#define CMDQ_READ_CONTEXT_TYPE_CQ 0x1UL +#define CMDQ_READ_CONTEXT_TYPE_MRW 0x2UL +#define CMDQ_READ_CONTEXT_TYPE_SRQ 0x3UL +#define CMDQ_READ_CONTEXT_TYPE_LAST CMDQ_READ_CONTEXT_TYPE_SRQ +u8 unused_0[3 ]; +}; + +/* creq_read_context (size:128b/16B) */ +struct creq_read_context { +u8 type; +#define CREQ_READ_CONTEXT_TYPE_MASK 0x3fUL +#define CREQ_READ_CONTEXT_TYPE_SFT 0 +#define CREQ_READ_CONTEXT_TYPE_QP_EVENT 0x38UL +#define CREQ_READ_CONTEXT_TYPE_LAST CREQ_READ_CONTEXT_TYPE_QP_EVENT +u8 status; +__le16 cookie; +__le32 reserved32; +u8 v; +#define CREQ_READ_CONTEXT_V 0x1UL +u8 event; +#define CREQ_READ_CONTEXT_EVENT_READ_CONTEXT 0x85UL +#define CREQ_READ_CONTEXT_EVENT_LAST CREQ_READ_CONTEXT_EVENT_READ_CONTEXT +__le16 reserved16; +__le32 reserved_32; +}; +/* cmdq_map_tc_to_cos (size:192b/24B) */ struct cmdq_map_tc_to_cos {u8 opcode;
Signature · 1 line
2.5.5
Selvin Xavier
maintainerPATCH v2 3/4 RDMA/bnxt_re: Support raw data query for each resources
In reply to Selvin XavierFrom: Kashyap Desai <[email protected]>
Support interfaces to get the raw data for each of the resources. Use this interface to get some of the HW structures from active resources.
--- drivers/infiniband/hw/bnxt_re/main.c | 118 +++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+)
drivers/infiniband/hw/bnxt_re/main.c +118 -0
@@ -903,6 +903,35 @@ static int bnxt_re_fill_res_mr_entry(struct sk_buff *msg, struct ib_mr *ib_mr)return -EMSGSIZE ; } +static int bnxt_re_fill_res_mr_entry_raw (struct sk_buff *msg,struct ib_mr *ib_mr) +{ +struct bnxt_re_dev *rdev; +struct bnxt_re_mr *mr; +int err, len; +void *data; + + mr = container_of(ib_mr, struct bnxt_re_mr, ib_mr); + rdev = mr->rdev; + + err =bnxt_re_read_context_allowed (rdev); +if (err) +return err; + + len =bnxt_qplib_is_chip_gen_p7 (rdev->chip_ctx) ?BNXT_RE_CONTEXT_TYPE_MRW_SIZE_P7 : +BNXT_RE_CONTEXT_TYPE_MRW_SIZE_P5 ; + data =kzalloc (len,GFP_KERNEL ); +if (!data) +return -ENOMEM ; + + err =bnxt_qplib_read_context (&rdev->rcfw,CMDQ_READ_CONTEXT_TYPE_MRW , + mr->qplib_mr.lkey, len, data); +if (!err) + err =nla_put (msg,RDMA_NLDEV_ATTR_RES_RAW , len, data); + +kfree (data); +return err; +} +static int bnxt_re_fill_res_cq_entry (struct sk_buff *msg,struct ib_cq *ib_cq) {struct bnxt_qplib_hwq *cq_hwq;
@@ -933,6 +962,36 @@ static int bnxt_re_fill_res_cq_entry(struct sk_buff *msg, struct ib_cq *ib_cq)return -EMSGSIZE ; } +static int bnxt_re_fill_res_cq_entry_raw (struct sk_buff *msg,struct ib_cq *ib_cq) +{ +struct bnxt_re_dev *rdev; +struct bnxt_re_cq *cq; +int err, len; +void *data; + + cq = container_of(ib_cq, struct bnxt_re_cq, ib_cq); + rdev = cq->rdev; + + err =bnxt_re_read_context_allowed (rdev); +if (err) +return err; + + len =bnxt_qplib_is_chip_gen_p7 (rdev->chip_ctx) ?BNXT_RE_CONTEXT_TYPE_CQ_SIZE_P7 : +BNXT_RE_CONTEXT_TYPE_CQ_SIZE_P5 ; + data =kzalloc (len,GFP_KERNEL ); +if (!data) +return -ENOMEM ; + + err =bnxt_qplib_read_context (&rdev->rcfw, +CMDQ_READ_CONTEXT_TYPE_CQ , + cq->qplib_cq.id, len, data); +if (!err) + err =nla_put (msg,RDMA_NLDEV_ATTR_RES_RAW , len, data); + +kfree (data); +return err; +} +static int bnxt_re_fill_res_qp_entry (struct sk_buff *msg,struct ib_qp *ib_qp) {struct bnxt_qplib_qp *qplib_qp;
@@ -977,6 +1036,31 @@ static int bnxt_re_fill_res_qp_entry(struct sk_buff *msg, struct ib_qp *ib_qp)return -EMSGSIZE ; } +static int bnxt_re_fill_res_qp_entry_raw (struct sk_buff *msg,struct ib_qp *ibqp) +{ +struct bnxt_re_dev *rdev =to_bnxt_re_dev (ibqp->device, ibdev); +int err, len; +void *data; + + err =bnxt_re_read_context_allowed (rdev); +if (err) +return err; + + len =bnxt_qplib_is_chip_gen_p7 (rdev->chip_ctx) ?BNXT_RE_CONTEXT_TYPE_QPC_SIZE_P7 : +BNXT_RE_CONTEXT_TYPE_QPC_SIZE_P5 ; + data =kzalloc (len,GFP_KERNEL ); +if (!data) +return -ENOMEM ; + + err =bnxt_qplib_read_context (&rdev->rcfw,CMDQ_READ_CONTEXT_TYPE_QPC , + ibqp->qp_num, len, data); +if (!err) + err =nla_put (msg,RDMA_NLDEV_ATTR_RES_RAW , len, data); + +kfree (data); +return err; +} +static int bnxt_re_fill_res_srq_entry (struct sk_buff *msg,struct ib_srq *ib_srq) {struct nlattr *table_attr;
@@ -1003,6 +1087,36 @@ static int bnxt_re_fill_res_srq_entry(struct sk_buff *msg, struct ib_srq *ib_srqreturn -EMSGSIZE ; } +static int bnxt_re_fill_res_srq_entry_raw (struct sk_buff *msg,struct ib_srq *ib_srq) +{ +struct bnxt_re_dev *rdev; +struct bnxt_re_srq *srq; +int err, len; +void *data; + + srq = container_of(ib_srq, struct bnxt_re_srq, ib_srq); + rdev = srq->rdev; + + err =bnxt_re_read_context_allowed (rdev); +if (err) +return err; + + len =bnxt_qplib_is_chip_gen_p7 (rdev->chip_ctx) ?BNXT_RE_CONTEXT_TYPE_SRQ_SIZE_P7 : +BNXT_RE_CONTEXT_TYPE_SRQ_SIZE_P5 ; + + data =kzalloc (len,GFP_KERNEL ); +if (!data) +return -ENOMEM ; + + err =bnxt_qplib_read_context (&rdev->rcfw,CMDQ_READ_CONTEXT_TYPE_SRQ , + srq->qplib_srq.id, len, data); +if (!err) + err =nla_put (msg,RDMA_NLDEV_ATTR_RES_RAW , len, data); + +kfree (data); +return err; +} +static const struct ib_device_ops bnxt_re_dev_ops = { .owner =THIS_MODULE , .driver_id =RDMA_DRIVER_BNXT_RE ,
@@ -1063,9 +1177,13 @@ static const struct ib_device_ops bnxt_re_dev_ops = {static const struct ib_device_ops restrack_ops = { .fill_res_cq_entry = bnxt_re_fill_res_cq_entry, + .fill_res_cq_entry_raw = bnxt_re_fill_res_cq_entry_raw, .fill_res_qp_entry = bnxt_re_fill_res_qp_entry, + .fill_res_qp_entry_raw = bnxt_re_fill_res_qp_entry_raw, .fill_res_mr_entry = bnxt_re_fill_res_mr_entry, + .fill_res_mr_entry_raw = bnxt_re_fill_res_mr_entry_raw, .fill_res_srq_entry = bnxt_re_fill_res_srq_entry, + .fill_res_srq_entry_raw = bnxt_re_fill_res_srq_entry_raw, };static int bnxt_re_register_ib (struct bnxt_re_dev *rdev)
Signature · 1 line
2.5.5
Selvin Xavier
maintainerPATCH v2 4/4 RDMA/bnxt_re: Add debugfs hook in the driver
In reply to Selvin XavierFrom: Kalesh AP <[email protected]>
Adding support for a per device debugfs folder for exporting some of the device specific debug information. Added support to get QP info for now. The same folder can be used to export other debug features in future.
---
v1 - v2 :
- Avoid unnecessary NULL check while deleting the debugfs directory
drivers/infiniband/hw/bnxt_re/Makefile | 3 +- drivers/infiniband/hw/bnxt_re/bnxt_re.h | 2 + drivers/infiniband/hw/bnxt_re/debugfs.c | 138 +++++++++++++++++++++++++++++++ drivers/infiniband/hw/bnxt_re/debugfs.h | 21 +++++ drivers/infiniband/hw/bnxt_re/ib_verbs.c | 4 + drivers/infiniband/hw/bnxt_re/ib_verbs.h | 1 + drivers/infiniband/hw/bnxt_re/main.c | 13 ++- 7 files changed, 180 insertions(+), 2 deletions(-) create mode 100644 drivers/infiniband/hw/bnxt_re/debugfs.c create mode 100644 drivers/infiniband/hw/bnxt_re/debugfs.h
drivers/infiniband/hw/bnxt_re/Makefile +2 -1
@@ -4,4 +4,5 @@ ccflags-y := -I $(srctree)/drivers/net/ethernet/broadcom/bnxt obj-$(CONFIG_INFINIBAND_BNXT_RE) += bnxt_re.o bnxt_re-y := main.o ib_verbs.o \ qplib_res.o qplib_rcfw.o \ - qplib_sp.o qplib_fp.o hw_counters.o + qplib_sp.o qplib_fp.o hw_counters.o \ + debugfs.o
drivers/infiniband/hw/bnxt_re/bnxt_re.h +2 -0
@@ -221,6 +221,8 @@ struct bnxt_re_dev {struct delayed_work dbq_pacing_work;DECLARE_HASHTABLE (cq_hash,MAX_CQ_HASH_BITS );DECLARE_HASHTABLE (srq_hash,MAX_SRQ_HASH_BITS ); +struct dentry *dbg_root; +struct dentry *qp_debugfs; };#define to_bnxt_re_dev (ptr, member) \
drivers/infiniband/hw/bnxt_re/debugfs.c new file +138 -0
138 lines not on this page · raw message
drivers/infiniband/hw/bnxt_re/debugfs.h new file +21 -0
@@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause +/* +* Copyright (c) 2024, Broadcom. All rights reserved. The term +* Broadcom refers to Broadcom Limited and/or its subsidiaries. +* +* Description: Debugfs header +*/ + +#ifndef __BNXT_RE_DEBUGFS__ +#define __BNXT_RE_DEBUGFS__ + +void bnxt_re_debug_add_qpinfo (struct bnxt_re_dev *rdev,struct bnxt_re_qp *qp); +void bnxt_re_debug_rem_qpinfo (struct bnxt_re_dev *rdev,struct bnxt_re_qp *qp); + +void bnxt_re_debugfs_add_pdev (struct bnxt_re_dev *rdev); +void bnxt_re_debugfs_rem_pdev (struct bnxt_re_dev *rdev); + +void bnxt_re_register_debugfs (void ); +void bnxt_re_unregister_debugfs (void ); + +#endif
drivers/infiniband/hw/bnxt_re/ib_verbs.c +4 -0
@@ -62,6 +62,7 @@#include "bnxt_re.h" #include "ib_verbs.h" +#include "debugfs.h" #include <rdma/uverbs_types.h> #include <rdma/uverbs_std_types.h>
@@ -997,6 +998,8 @@ int bnxt_re_destroy_qp(struct ib_qp *ib_qp, struct ib_udata *udata)else if (qp->qplib_qp.type ==CMDQ_CREATE_QP_TYPE_UD )atomic_dec (&rdev->stats.res.ud_qp_count); +bnxt_re_debug_rem_qpinfo (rdev, qp); +ib_umem_release (qp->rumem);ib_umem_release (qp->sumem);
@@ -1676,6 +1679,7 @@ int bnxt_re_create_qp(struct ib_qp *ib_qp, struct ib_qp_init_attr *qp_init_attr,if (active_qps > rdev->stats.res.ud_qp_watermark) rdev->stats.res.ud_qp_watermark = active_qps; } +bnxt_re_debug_add_qpinfo (rdev, qp);return 0 ; qp_destroy:
drivers/infiniband/hw/bnxt_re/ib_verbs.h +1 -0
@@ -95,6 +95,7 @@ struct bnxt_re_qp {struct ib_ud_header qp1_hdr;struct bnxt_re_cq *scq;struct bnxt_re_cq *rcq; +struct dentry *dentry; };struct bnxt_re_cq {
drivers/infiniband/hw/bnxt_re/main.c +12 -1
@@ -67,6 +67,7 @@#include <rdma/bnxt_re-abi.h> #include "bnxt.h" #include "hw_counters.h" +#include "debugfs.h" static char version[] =BNXT_RE_DESC "\n" ;
@@ -1863,6 +1864,8 @@ static void bnxt_re_dev_uninit(struct bnxt_re_dev *rdev, u8 op_type)u8 type;int rc; +bnxt_re_debugfs_rem_pdev (rdev); +if (test_and_clear_bit (BNXT_RE_FLAG_QOS_WORK_REG , &rdev->flags))cancel_delayed_work_sync (&rdev->worker);
@@ -2063,6 +2066,8 @@ static int bnxt_re_dev_init(struct bnxt_re_dev *rdev, u8 op_type)if (rdev->chip_ctx->modes.toggle_bits &BNXT_QPLIB_SRQ_TOGGLE_BIT )hash_init (rdev->srq_hash); +bnxt_re_debugfs_add_pdev (rdev); +return 0 ; free_sctx:bnxt_re_net_stats_ctx_free (rdev, rdev->qplib_ctx.stats.fw_id);
@@ -2389,18 +2394,24 @@ static int __init bnxt_re_mod_init(void)int rc;pr_info ("%s: %s" ,ROCE_DRV_MODULE_NAME , version); +bnxt_re_register_debugfs (); + rc =auxiliary_driver_register (&bnxt_re_driver);if (rc) {pr_err ("%s: Failed to register auxiliary driver\n" ,ROCE_DRV_MODULE_NAME ); -return rc; + goto err_debug; }return 0 ; +err_debug: +bnxt_re_unregister_debugfs (); +return rc; } static void __exit bnxt_re_mod_exit(void) {auxiliary_driver_unregister (&bnxt_re_driver); +bnxt_re_unregister_debugfs (); }module_init (bnxt_re_mod_init);
Signature · 1 line
2.5.5
Leon Romanovsky
AppliedQuoted 10 lines · Selvin Xavier
This series is the first set that enables few debug options in
bnxt_redriver. Implements the basic driver data collection using the rdma tool. Also, implements raw data query option to get some of the Hardware specific information for analysis. Added a debugfs folder forbnxt_recorresponding to each PCI device to display some of the driver specific information. This will be enhanced in future series.[...]
Applied, thanks!
[1/4] RDMA/bnxt_re: Support driver specific data collection using rdma tool
https://git.kernel.org/rdma/rdma/c/955e80fc08c2ae [2/4] RDMA/bnxt_re: Add support for querying HW contexts https://git.kernel.org/rdma/rdma/c/c25a9c4e132418 [3/4] RDMA/bnxt_re: Support raw data query for each resources https://git.kernel.org/rdma/rdma/c/fe937d11b6062d [4/4] RDMA/bnxt_re: Add debugfs hook in the driver https://git.kernel.org/rdma/rdma/c/07849569546ff8
Best regards,
Signature · 1 line
Leon Romanovsky <[email protected]>