RDMA/nldev: Dynamically generate restrack dumpit callbacks
There is no need to manually write same callbacks, automatically generate them using C-macro language. This macro is going to be extended to generate doit callbacks too, so use general name for this macro. Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:
parent
cf34e1fe52
commit
f732e7135b
|
@ -1077,35 +1077,18 @@ next: idx++;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nldev_res_get_qp_dumpit(struct sk_buff *skb,
|
#define RES_GET_FUNCS(name, type) \
|
||||||
struct netlink_callback *cb)
|
static int nldev_res_get_##name##_dumpit(struct sk_buff *skb, \
|
||||||
{
|
struct netlink_callback *cb) \
|
||||||
return res_get_common_dumpit(skb, cb, RDMA_RESTRACK_QP);
|
{ \
|
||||||
}
|
return res_get_common_dumpit(skb, cb, type); \
|
||||||
|
}
|
||||||
|
|
||||||
static int nldev_res_get_cm_id_dumpit(struct sk_buff *skb,
|
RES_GET_FUNCS(qp, RDMA_RESTRACK_QP);
|
||||||
struct netlink_callback *cb)
|
RES_GET_FUNCS(cm_id, RDMA_RESTRACK_CM_ID);
|
||||||
{
|
RES_GET_FUNCS(cq, RDMA_RESTRACK_CQ);
|
||||||
return res_get_common_dumpit(skb, cb, RDMA_RESTRACK_CM_ID);
|
RES_GET_FUNCS(pd, RDMA_RESTRACK_PD);
|
||||||
}
|
RES_GET_FUNCS(mr, RDMA_RESTRACK_MR);
|
||||||
|
|
||||||
static int nldev_res_get_cq_dumpit(struct sk_buff *skb,
|
|
||||||
struct netlink_callback *cb)
|
|
||||||
{
|
|
||||||
return res_get_common_dumpit(skb, cb, RDMA_RESTRACK_CQ);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int nldev_res_get_mr_dumpit(struct sk_buff *skb,
|
|
||||||
struct netlink_callback *cb)
|
|
||||||
{
|
|
||||||
return res_get_common_dumpit(skb, cb, RDMA_RESTRACK_MR);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int nldev_res_get_pd_dumpit(struct sk_buff *skb,
|
|
||||||
struct netlink_callback *cb)
|
|
||||||
{
|
|
||||||
return res_get_common_dumpit(skb, cb, RDMA_RESTRACK_PD);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct rdma_nl_cbs nldev_cb_table[RDMA_NLDEV_NUM_OPS] = {
|
static const struct rdma_nl_cbs nldev_cb_table[RDMA_NLDEV_NUM_OPS] = {
|
||||||
[RDMA_NLDEV_CMD_GET] = {
|
[RDMA_NLDEV_CMD_GET] = {
|
||||||
|
|
Loading…
Reference in New Issue