Skip to content

Commit e4bcf8e

Browse files
kadesai16rleon
authored andcommitted
RDMA/bnxt_re: Support raw data query for each resources
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. Signed-off-by: Kashyap Desai <[email protected]> Signed-off-by: Selvin Xavier <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Leon Romanovsky <[email protected]>
1 parent 3b72946 commit e4bcf8e

File tree

1 file changed

+118
-0
lines changed
  • drivers/infiniband/hw/bnxt_re

1 file changed

+118
-0
lines changed

drivers/infiniband/hw/bnxt_re/main.c

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -903,6 +903,35 @@ static int bnxt_re_fill_res_mr_entry(struct sk_buff *msg, struct ib_mr *ib_mr)
903903
return -EMSGSIZE;
904904
}
905905

906+
static int bnxt_re_fill_res_mr_entry_raw(struct sk_buff *msg, struct ib_mr *ib_mr)
907+
{
908+
struct bnxt_re_dev *rdev;
909+
struct bnxt_re_mr *mr;
910+
int err, len;
911+
void *data;
912+
913+
mr = container_of(ib_mr, struct bnxt_re_mr, ib_mr);
914+
rdev = mr->rdev;
915+
916+
err = bnxt_re_read_context_allowed(rdev);
917+
if (err)
918+
return err;
919+
920+
len = bnxt_qplib_is_chip_gen_p7(rdev->chip_ctx) ? BNXT_RE_CONTEXT_TYPE_MRW_SIZE_P7 :
921+
BNXT_RE_CONTEXT_TYPE_MRW_SIZE_P5;
922+
data = kzalloc(len, GFP_KERNEL);
923+
if (!data)
924+
return -ENOMEM;
925+
926+
err = bnxt_qplib_read_context(&rdev->rcfw, CMDQ_READ_CONTEXT_TYPE_MRW,
927+
mr->qplib_mr.lkey, len, data);
928+
if (!err)
929+
err = nla_put(msg, RDMA_NLDEV_ATTR_RES_RAW, len, data);
930+
931+
kfree(data);
932+
return err;
933+
}
934+
906935
static int bnxt_re_fill_res_cq_entry(struct sk_buff *msg, struct ib_cq *ib_cq)
907936
{
908937
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)
933962
return -EMSGSIZE;
934963
}
935964

965+
static int bnxt_re_fill_res_cq_entry_raw(struct sk_buff *msg, struct ib_cq *ib_cq)
966+
{
967+
struct bnxt_re_dev *rdev;
968+
struct bnxt_re_cq *cq;
969+
int err, len;
970+
void *data;
971+
972+
cq = container_of(ib_cq, struct bnxt_re_cq, ib_cq);
973+
rdev = cq->rdev;
974+
975+
err = bnxt_re_read_context_allowed(rdev);
976+
if (err)
977+
return err;
978+
979+
len = bnxt_qplib_is_chip_gen_p7(rdev->chip_ctx) ? BNXT_RE_CONTEXT_TYPE_CQ_SIZE_P7 :
980+
BNXT_RE_CONTEXT_TYPE_CQ_SIZE_P5;
981+
data = kzalloc(len, GFP_KERNEL);
982+
if (!data)
983+
return -ENOMEM;
984+
985+
err = bnxt_qplib_read_context(&rdev->rcfw,
986+
CMDQ_READ_CONTEXT_TYPE_CQ,
987+
cq->qplib_cq.id, len, data);
988+
if (!err)
989+
err = nla_put(msg, RDMA_NLDEV_ATTR_RES_RAW, len, data);
990+
991+
kfree(data);
992+
return err;
993+
}
994+
936995
static int bnxt_re_fill_res_qp_entry(struct sk_buff *msg, struct ib_qp *ib_qp)
937996
{
938997
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)
9771036
return -EMSGSIZE;
9781037
}
9791038

1039+
static int bnxt_re_fill_res_qp_entry_raw(struct sk_buff *msg, struct ib_qp *ibqp)
1040+
{
1041+
struct bnxt_re_dev *rdev = to_bnxt_re_dev(ibqp->device, ibdev);
1042+
int err, len;
1043+
void *data;
1044+
1045+
err = bnxt_re_read_context_allowed(rdev);
1046+
if (err)
1047+
return err;
1048+
1049+
len = bnxt_qplib_is_chip_gen_p7(rdev->chip_ctx) ? BNXT_RE_CONTEXT_TYPE_QPC_SIZE_P7 :
1050+
BNXT_RE_CONTEXT_TYPE_QPC_SIZE_P5;
1051+
data = kzalloc(len, GFP_KERNEL);
1052+
if (!data)
1053+
return -ENOMEM;
1054+
1055+
err = bnxt_qplib_read_context(&rdev->rcfw, CMDQ_READ_CONTEXT_TYPE_QPC,
1056+
ibqp->qp_num, len, data);
1057+
if (!err)
1058+
err = nla_put(msg, RDMA_NLDEV_ATTR_RES_RAW, len, data);
1059+
1060+
kfree(data);
1061+
return err;
1062+
}
1063+
9801064
static int bnxt_re_fill_res_srq_entry(struct sk_buff *msg, struct ib_srq *ib_srq)
9811065
{
9821066
struct nlattr *table_attr;
@@ -1003,6 +1087,36 @@ static int bnxt_re_fill_res_srq_entry(struct sk_buff *msg, struct ib_srq *ib_srq
10031087
return -EMSGSIZE;
10041088
}
10051089

1090+
static int bnxt_re_fill_res_srq_entry_raw(struct sk_buff *msg, struct ib_srq *ib_srq)
1091+
{
1092+
struct bnxt_re_dev *rdev;
1093+
struct bnxt_re_srq *srq;
1094+
int err, len;
1095+
void *data;
1096+
1097+
srq = container_of(ib_srq, struct bnxt_re_srq, ib_srq);
1098+
rdev = srq->rdev;
1099+
1100+
err = bnxt_re_read_context_allowed(rdev);
1101+
if (err)
1102+
return err;
1103+
1104+
len = bnxt_qplib_is_chip_gen_p7(rdev->chip_ctx) ? BNXT_RE_CONTEXT_TYPE_SRQ_SIZE_P7 :
1105+
BNXT_RE_CONTEXT_TYPE_SRQ_SIZE_P5;
1106+
1107+
data = kzalloc(len, GFP_KERNEL);
1108+
if (!data)
1109+
return -ENOMEM;
1110+
1111+
err = bnxt_qplib_read_context(&rdev->rcfw, CMDQ_READ_CONTEXT_TYPE_SRQ,
1112+
srq->qplib_srq.id, len, data);
1113+
if (!err)
1114+
err = nla_put(msg, RDMA_NLDEV_ATTR_RES_RAW, len, data);
1115+
1116+
kfree(data);
1117+
return err;
1118+
}
1119+
10061120
static const struct ib_device_ops bnxt_re_dev_ops = {
10071121
.owner = THIS_MODULE,
10081122
.driver_id = RDMA_DRIVER_BNXT_RE,
@@ -1063,9 +1177,13 @@ static const struct ib_device_ops bnxt_re_dev_ops = {
10631177

10641178
static const struct ib_device_ops restrack_ops = {
10651179
.fill_res_cq_entry = bnxt_re_fill_res_cq_entry,
1180+
.fill_res_cq_entry_raw = bnxt_re_fill_res_cq_entry_raw,
10661181
.fill_res_qp_entry = bnxt_re_fill_res_qp_entry,
1182+
.fill_res_qp_entry_raw = bnxt_re_fill_res_qp_entry_raw,
10671183
.fill_res_mr_entry = bnxt_re_fill_res_mr_entry,
1184+
.fill_res_mr_entry_raw = bnxt_re_fill_res_mr_entry_raw,
10681185
.fill_res_srq_entry = bnxt_re_fill_res_srq_entry,
1186+
.fill_res_srq_entry_raw = bnxt_re_fill_res_srq_entry_raw,
10691187
};
10701188

10711189
static int bnxt_re_register_ib(struct bnxt_re_dev *rdev)

0 commit comments

Comments
 (0)