RDMA/core: Add dedicated SRQ resource tracker function

Add a dedicated callback function for SRQ resource tracker.

Signed-off-by: wenglianfa <wenglianfa@huawei.com>
Link: https://lore.kernel.org/r/20230918131110.3987498-2-huangjunxian6@hisilicon.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
This commit is contained in:
wenglianfa 2023-09-18 21:11:08 +08:00 committed by Leon Romanovsky
parent 8bf7187d97
commit 0e32d7d43b
3 changed files with 10 additions and 1 deletions

View File

@ -2651,6 +2651,7 @@ void ib_set_device_ops(struct ib_device *dev, const struct ib_device_ops *ops)
SET_DEVICE_OP(dev_ops, fill_res_mr_entry_raw); SET_DEVICE_OP(dev_ops, fill_res_mr_entry_raw);
SET_DEVICE_OP(dev_ops, fill_res_qp_entry); SET_DEVICE_OP(dev_ops, fill_res_qp_entry);
SET_DEVICE_OP(dev_ops, fill_res_qp_entry_raw); SET_DEVICE_OP(dev_ops, fill_res_qp_entry_raw);
SET_DEVICE_OP(dev_ops, fill_res_srq_entry);
SET_DEVICE_OP(dev_ops, fill_stat_mr_entry); SET_DEVICE_OP(dev_ops, fill_stat_mr_entry);
SET_DEVICE_OP(dev_ops, get_dev_fw_str); SET_DEVICE_OP(dev_ops, get_dev_fw_str);
SET_DEVICE_OP(dev_ops, get_dma_mr); SET_DEVICE_OP(dev_ops, get_dma_mr);

View File

@ -818,6 +818,7 @@ static int fill_res_srq_entry(struct sk_buff *msg, bool has_cap_net_admin,
struct rdma_restrack_entry *res, uint32_t port) struct rdma_restrack_entry *res, uint32_t port)
{ {
struct ib_srq *srq = container_of(res, struct ib_srq, res); struct ib_srq *srq = container_of(res, struct ib_srq, res);
struct ib_device *dev = srq->device;
if (nla_put_u32(msg, RDMA_NLDEV_ATTR_RES_SRQN, srq->res.id)) if (nla_put_u32(msg, RDMA_NLDEV_ATTR_RES_SRQN, srq->res.id))
goto err; goto err;
@ -837,7 +838,13 @@ static int fill_res_srq_entry(struct sk_buff *msg, bool has_cap_net_admin,
if (fill_res_srq_qps(msg, srq)) if (fill_res_srq_qps(msg, srq))
goto err; goto err;
return fill_res_name_pid(msg, res); if (fill_res_name_pid(msg, res))
goto err;
if (dev->ops.fill_res_srq_entry)
return dev->ops.fill_res_srq_entry(msg, srq);
return 0;
err: err:
return -EMSGSIZE; return -EMSGSIZE;

View File

@ -2608,6 +2608,7 @@ struct ib_device_ops {
int (*fill_res_qp_entry)(struct sk_buff *msg, struct ib_qp *ibqp); int (*fill_res_qp_entry)(struct sk_buff *msg, struct ib_qp *ibqp);
int (*fill_res_qp_entry_raw)(struct sk_buff *msg, struct ib_qp *ibqp); int (*fill_res_qp_entry_raw)(struct sk_buff *msg, struct ib_qp *ibqp);
int (*fill_res_cm_id_entry)(struct sk_buff *msg, struct rdma_cm_id *id); int (*fill_res_cm_id_entry)(struct sk_buff *msg, struct rdma_cm_id *id);
int (*fill_res_srq_entry)(struct sk_buff *msg, struct ib_srq *ib_srq);
/* Device lifecycle callbacks */ /* Device lifecycle callbacks */
/* /*