|
@@ -98,6 +98,15 @@ static const struct nla_policy nldev_policy[RDMA_NLDEV_ATTR_MAX] = {
|
|
[RDMA_NLDEV_ATTR_NDEV_INDEX] = { .type = NLA_U32 },
|
|
[RDMA_NLDEV_ATTR_NDEV_INDEX] = { .type = NLA_U32 },
|
|
[RDMA_NLDEV_ATTR_NDEV_NAME] = { .type = NLA_NUL_STRING,
|
|
[RDMA_NLDEV_ATTR_NDEV_NAME] = { .type = NLA_NUL_STRING,
|
|
.len = IFNAMSIZ },
|
|
.len = IFNAMSIZ },
|
|
|
|
+ [RDMA_NLDEV_ATTR_DRIVER] = { .type = NLA_NESTED },
|
|
|
|
+ [RDMA_NLDEV_ATTR_DRIVER_ENTRY] = { .type = NLA_NESTED },
|
|
|
|
+ [RDMA_NLDEV_ATTR_DRIVER_STRING] = { .type = NLA_NUL_STRING,
|
|
|
|
+ .len = RDMA_NLDEV_ATTR_ENTRY_STRLEN },
|
|
|
|
+ [RDMA_NLDEV_ATTR_DRIVER_PRINT_TYPE] = { .type = NLA_U8 },
|
|
|
|
+ [RDMA_NLDEV_ATTR_DRIVER_S32] = { .type = NLA_S32 },
|
|
|
|
+ [RDMA_NLDEV_ATTR_DRIVER_U32] = { .type = NLA_U32 },
|
|
|
|
+ [RDMA_NLDEV_ATTR_DRIVER_S64] = { .type = NLA_S64 },
|
|
|
|
+ [RDMA_NLDEV_ATTR_DRIVER_U64] = { .type = NLA_U64 },
|
|
};
|
|
};
|
|
|
|
|
|
static int fill_nldev_handle(struct sk_buff *msg, struct ib_device *device)
|
|
static int fill_nldev_handle(struct sk_buff *msg, struct ib_device *device)
|
|
@@ -285,6 +294,7 @@ static int fill_res_qp_entry(struct sk_buff *msg, struct netlink_callback *cb,
|
|
struct rdma_restrack_entry *res, uint32_t port)
|
|
struct rdma_restrack_entry *res, uint32_t port)
|
|
{
|
|
{
|
|
struct ib_qp *qp = container_of(res, struct ib_qp, res);
|
|
struct ib_qp *qp = container_of(res, struct ib_qp, res);
|
|
|
|
+ struct rdma_restrack_root *resroot = &qp->device->res;
|
|
struct ib_qp_init_attr qp_init_attr;
|
|
struct ib_qp_init_attr qp_init_attr;
|
|
struct nlattr *entry_attr;
|
|
struct nlattr *entry_attr;
|
|
struct ib_qp_attr qp_attr;
|
|
struct ib_qp_attr qp_attr;
|
|
@@ -334,6 +344,9 @@ static int fill_res_qp_entry(struct sk_buff *msg, struct netlink_callback *cb,
|
|
if (fill_res_name_pid(msg, res))
|
|
if (fill_res_name_pid(msg, res))
|
|
goto err;
|
|
goto err;
|
|
|
|
|
|
|
|
+ if (resroot->fill_res_entry(msg, res))
|
|
|
|
+ goto err;
|
|
|
|
+
|
|
nla_nest_end(msg, entry_attr);
|
|
nla_nest_end(msg, entry_attr);
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
@@ -349,6 +362,7 @@ static int fill_res_cm_id_entry(struct sk_buff *msg,
|
|
{
|
|
{
|
|
struct rdma_id_private *id_priv =
|
|
struct rdma_id_private *id_priv =
|
|
container_of(res, struct rdma_id_private, res);
|
|
container_of(res, struct rdma_id_private, res);
|
|
|
|
+ struct rdma_restrack_root *resroot = &id_priv->id.device->res;
|
|
struct rdma_cm_id *cm_id = &id_priv->id;
|
|
struct rdma_cm_id *cm_id = &id_priv->id;
|
|
struct nlattr *entry_attr;
|
|
struct nlattr *entry_attr;
|
|
|
|
|
|
@@ -390,6 +404,9 @@ static int fill_res_cm_id_entry(struct sk_buff *msg,
|
|
if (fill_res_name_pid(msg, res))
|
|
if (fill_res_name_pid(msg, res))
|
|
goto err;
|
|
goto err;
|
|
|
|
|
|
|
|
+ if (resroot->fill_res_entry(msg, res))
|
|
|
|
+ goto err;
|
|
|
|
+
|
|
nla_nest_end(msg, entry_attr);
|
|
nla_nest_end(msg, entry_attr);
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
@@ -403,6 +420,7 @@ static int fill_res_cq_entry(struct sk_buff *msg, struct netlink_callback *cb,
|
|
struct rdma_restrack_entry *res, uint32_t port)
|
|
struct rdma_restrack_entry *res, uint32_t port)
|
|
{
|
|
{
|
|
struct ib_cq *cq = container_of(res, struct ib_cq, res);
|
|
struct ib_cq *cq = container_of(res, struct ib_cq, res);
|
|
|
|
+ struct rdma_restrack_root *resroot = &cq->device->res;
|
|
struct nlattr *entry_attr;
|
|
struct nlattr *entry_attr;
|
|
|
|
|
|
entry_attr = nla_nest_start(msg, RDMA_NLDEV_ATTR_RES_CQ_ENTRY);
|
|
entry_attr = nla_nest_start(msg, RDMA_NLDEV_ATTR_RES_CQ_ENTRY);
|
|
@@ -423,6 +441,9 @@ static int fill_res_cq_entry(struct sk_buff *msg, struct netlink_callback *cb,
|
|
if (fill_res_name_pid(msg, res))
|
|
if (fill_res_name_pid(msg, res))
|
|
goto err;
|
|
goto err;
|
|
|
|
|
|
|
|
+ if (resroot->fill_res_entry(msg, res))
|
|
|
|
+ goto err;
|
|
|
|
+
|
|
nla_nest_end(msg, entry_attr);
|
|
nla_nest_end(msg, entry_attr);
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
@@ -436,6 +457,7 @@ static int fill_res_mr_entry(struct sk_buff *msg, struct netlink_callback *cb,
|
|
struct rdma_restrack_entry *res, uint32_t port)
|
|
struct rdma_restrack_entry *res, uint32_t port)
|
|
{
|
|
{
|
|
struct ib_mr *mr = container_of(res, struct ib_mr, res);
|
|
struct ib_mr *mr = container_of(res, struct ib_mr, res);
|
|
|
|
+ struct rdma_restrack_root *resroot = &mr->pd->device->res;
|
|
struct nlattr *entry_attr;
|
|
struct nlattr *entry_attr;
|
|
|
|
|
|
entry_attr = nla_nest_start(msg, RDMA_NLDEV_ATTR_RES_MR_ENTRY);
|
|
entry_attr = nla_nest_start(msg, RDMA_NLDEV_ATTR_RES_MR_ENTRY);
|
|
@@ -459,6 +481,9 @@ static int fill_res_mr_entry(struct sk_buff *msg, struct netlink_callback *cb,
|
|
if (fill_res_name_pid(msg, res))
|
|
if (fill_res_name_pid(msg, res))
|
|
goto err;
|
|
goto err;
|
|
|
|
|
|
|
|
+ if (resroot->fill_res_entry(msg, res))
|
|
|
|
+ goto err;
|
|
|
|
+
|
|
nla_nest_end(msg, entry_attr);
|
|
nla_nest_end(msg, entry_attr);
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
@@ -472,6 +497,7 @@ static int fill_res_pd_entry(struct sk_buff *msg, struct netlink_callback *cb,
|
|
struct rdma_restrack_entry *res, uint32_t port)
|
|
struct rdma_restrack_entry *res, uint32_t port)
|
|
{
|
|
{
|
|
struct ib_pd *pd = container_of(res, struct ib_pd, res);
|
|
struct ib_pd *pd = container_of(res, struct ib_pd, res);
|
|
|
|
+ struct rdma_restrack_root *resroot = &pd->device->res;
|
|
struct nlattr *entry_attr;
|
|
struct nlattr *entry_attr;
|
|
|
|
|
|
entry_attr = nla_nest_start(msg, RDMA_NLDEV_ATTR_RES_PD_ENTRY);
|
|
entry_attr = nla_nest_start(msg, RDMA_NLDEV_ATTR_RES_PD_ENTRY);
|
|
@@ -498,6 +524,9 @@ static int fill_res_pd_entry(struct sk_buff *msg, struct netlink_callback *cb,
|
|
if (fill_res_name_pid(msg, res))
|
|
if (fill_res_name_pid(msg, res))
|
|
goto err;
|
|
goto err;
|
|
|
|
|
|
|
|
+ if (resroot->fill_res_entry(msg, res))
|
|
|
|
+ goto err;
|
|
|
|
+
|
|
nla_nest_end(msg, entry_attr);
|
|
nla_nest_end(msg, entry_attr);
|
|
return 0;
|
|
return 0;
|
|
|
|
|