Skip to content

Commit 5cc3411

Browse files
Maor Gottliebjgunthorpe
authored andcommitted
RDMA: Add dedicated QP resource tracker function
In order to avoid double multiplexing of the resource when it is a QP, add a dedicated callback function. Link: https://lore.kernel.org/r/20200623113043.1228482-7-leon@kernel.org Signed-off-by: Maor Gottlieb <maorg@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
1 parent 9e2a187 commit 5cc3411

File tree

5 files changed

+6
-7
lines changed

5 files changed

+6
-7
lines changed

drivers/infiniband/core/device.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2620,6 +2620,7 @@ void ib_set_device_ops(struct ib_device *dev, const struct ib_device_ops *ops)
26202620
SET_DEVICE_OP(dev_ops, fill_res_cq_entry);
26212621
SET_DEVICE_OP(dev_ops, fill_res_entry);
26222622
SET_DEVICE_OP(dev_ops, fill_res_mr_entry);
2623+
SET_DEVICE_OP(dev_ops, fill_res_qp_entry);
26232624
SET_DEVICE_OP(dev_ops, fill_stat_mr_entry);
26242625
SET_DEVICE_OP(dev_ops, get_dev_fw_str);
26252626
SET_DEVICE_OP(dev_ops, get_dma_mr);

drivers/infiniband/core/nldev.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -507,9 +507,8 @@ static int fill_res_qp_entry(struct sk_buff *msg, bool has_cap_net_admin,
507507
if (fill_res_name_pid(msg, res))
508508
goto err;
509509

510-
if (fill_res_entry(dev, msg, res))
511-
goto err;
512-
510+
if (dev->ops.fill_res_qp_entry)
511+
return dev->ops.fill_res_qp_entry(msg, qp);
513512
return 0;
514513

515514
err: return -EMSGSIZE;

drivers/infiniband/hw/cxgb4/iw_cxgb4.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,6 +1057,7 @@ typedef int c4iw_restrack_func(struct sk_buff *msg,
10571057
struct rdma_restrack_entry *res);
10581058
int c4iw_fill_res_mr_entry(struct sk_buff *msg, struct ib_mr *ibmr);
10591059
int c4iw_fill_res_cq_entry(struct sk_buff *msg, struct ib_cq *ibcq);
1060+
int c4iw_fill_res_qp_entry(struct sk_buff *msg, struct ib_qp *ibqp);
10601061
extern c4iw_restrack_func *c4iw_restrack_funcs[RDMA_RESTRACK_MAX];
10611062

10621063
#endif

drivers/infiniband/hw/cxgb4/restrack.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,8 @@ static int fill_swsqes(struct sk_buff *msg, struct t4_sq *sq,
134134
return -EMSGSIZE;
135135
}
136136

137-
static int fill_res_qp_entry(struct sk_buff *msg,
138-
struct rdma_restrack_entry *res)
137+
int c4iw_fill_res_qp_entry(struct sk_buff *msg, struct ib_qp *ibqp)
139138
{
140-
struct ib_qp *ibqp = container_of(res, struct ib_qp, res);
141139
struct t4_swsqe *fsp = NULL, *lsp = NULL;
142140
struct c4iw_qp *qhp = to_c4iw_qp(ibqp);
143141
u16 first_sq_idx = 0, last_sq_idx = 0;
@@ -490,6 +488,5 @@ int c4iw_fill_res_mr_entry(struct sk_buff *msg, struct ib_mr *ibmr)
490488
}
491489

492490
c4iw_restrack_func *c4iw_restrack_funcs[RDMA_RESTRACK_MAX] = {
493-
[RDMA_RESTRACK_QP] = fill_res_qp_entry,
494491
[RDMA_RESTRACK_CM_ID] = fill_res_ep_entry,
495492
};

include/rdma/ib_verbs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2585,6 +2585,7 @@ struct ib_device_ops {
25852585
struct rdma_restrack_entry *entry);
25862586
int (*fill_res_mr_entry)(struct sk_buff *msg, struct ib_mr *ibmr);
25872587
int (*fill_res_cq_entry)(struct sk_buff *msg, struct ib_cq *ibcq);
2588+
int (*fill_res_qp_entry)(struct sk_buff *msg, struct ib_qp *ibqp);
25882589

25892590
/* Device lifecycle callbacks */
25902591
/*

0 commit comments

Comments
 (0)