| @@ -137,6 +137,8 @@ static const struct nla_policy nldev_policy[RDMA_NLDEV_ATTR_MAX] = { · 136 unmodified lines |
| 137 | 137 | [RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_NAME]= { .type = NLA_NUL_STRING, |
| 138 | 138 | .len = RDMA_NLDEV_ATTR_EMPTY_STRING }, |
| 139 | 139 | [RDMA_NLDEV_ATTR_RES_TYPE] = { .type = NLA_U8 }, |
| 140 | + [RDMA_NLDEV_ATTR_RES_SUBTYPE] = { .type = NLA_NUL_STRING, |
| 141 | + .len = RDMA_NLDEV_ATTR_EMPTY_STRING }, |
| 140 | 142 | [RDMA_NLDEV_ATTR_RES_UNSAFE_GLOBAL_RKEY]= { .type = NLA_U32 }, |
| 141 | 143 | [RDMA_NLDEV_ATTR_RES_USECNT] = { .type = NLA_U64 }, |
| 142 | 144 | [RDMA_NLDEV_ATTR_RES_SRQ] = { .type = NLA_NESTED }, |
| @@ -164,6 +166,7 @@ static const struct nla_policy nldev_policy[RDMA_NLDEV_ATTR_MAX] = { · 21 unmodified lines |
| 164 | 166 | [RDMA_NLDEV_ATTR_STAT_HWCOUNTER_INDEX] = { .type = NLA_U32 }, |
| 165 | 167 | [RDMA_NLDEV_ATTR_STAT_HWCOUNTER_DYNAMIC] = { .type = NLA_U8 }, |
| 166 | 168 | [RDMA_NLDEV_SYS_ATTR_PRIVILEGED_QKEY_MODE] = { .type = NLA_U8 }, |
| 169 | + [RDMA_NLDEV_ATTR_DRIVER_DETAILS] = { .type = NLA_U8 }, |
| 167 | 170 | }; |
| 168 | 171 | |
| 169 | 172 | static int put_driver_name_print_type(struct sk_buff *msg, const char *name, |
| @@ -399,7 +402,8 @@ err: · 229 unmodified lines |
| 399 | 402 | return -EMSGSIZE; |
| 400 | 403 | } |
| 401 | 404 | |
| 402 | | −static int fill_res_info(struct sk_buff *msg, struct ib_device *device) |
| 405 | +static int fill_res_info(struct sk_buff *msg, struct ib_device *device, |
| 406 | + bool show_details) |
| 403 | 407 | { |
| 404 | 408 | static const char * const names[RDMA_RESTRACK_MAX] = { |
| 405 | 409 | [RDMA_RESTRACK_PD] = "pd", |
| @@ -424,7 +428,7 @@ static int fill_res_info(struct sk_buff *msg, struct ib_device *device) · 18 unmodified lines |
| 424 | 428 | for (i = 0; i < RDMA_RESTRACK_MAX; i++) { |
| 425 | 429 | if (!names[i]) |
| 426 | 430 | continue; |
| 427 | | − curr = rdma_restrack_count(device, i); |
| 431 | + curr = rdma_restrack_count(device, i, show_details); |
| 428 | 432 | ret = fill_res_info_entry(msg, names[i], curr); |
| 429 | 433 | if (ret) |
| 430 | 434 | goto err; |
| @@ -1305,6 +1309,7 @@ static int nldev_res_get_doit(struct sk_buff *skb, struct nlmsghdr *nlh, · 874 unmodified lines |
| 1305 | 1309 | struct netlink_ext_ack *extack) |
| 1306 | 1310 | { |
| 1307 | 1311 | struct nlattr *tb[RDMA_NLDEV_ATTR_MAX]; |
| 1312 | + bool show_details = false; |
| 1308 | 1313 | struct ib_device *device; |
| 1309 | 1314 | struct sk_buff *msg; |
| 1310 | 1315 | u32 index; |
| @@ -1320,6 +1325,9 @@ static int nldev_res_get_doit(struct sk_buff *skb, struct nlmsghdr *nlh, · 9 unmodified lines |
| 1320 | 1325 | if (!device) |
| 1321 | 1326 | return -EINVAL; |
| 1322 | 1327 | |
| 1328 | + if (tb[RDMA_NLDEV_ATTR_DRIVER_DETAILS]) |
| 1329 | + show_details = nla_get_u8(tb[RDMA_NLDEV_ATTR_DRIVER_DETAILS]); |
| 1330 | + |
| 1323 | 1331 | msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); |
| 1324 | 1332 | if (!msg) { |
| 1325 | 1333 | ret = -ENOMEM; |
| @@ -1334,7 +1342,7 @@ static int nldev_res_get_doit(struct sk_buff *skb, struct nlmsghdr *nlh, · 8 unmodified lines |
| 1334 | 1342 | goto err_free; |
| 1335 | 1343 | } |
| 1336 | 1344 | |
| 1337 | | − ret = fill_res_info(msg, device); |
| 1345 | + ret = fill_res_info(msg, device, show_details); |
| 1338 | 1346 | if (ret) |
| 1339 | 1347 | goto err_free; |
| 1340 | 1348 | |
| @@ -1364,7 +1372,7 @@ static int _nldev_res_get_dumpit(struct ib_device *device, · 23 unmodified lines |
| 1364 | 1372 | RDMA_NL_GET_TYPE(RDMA_NL_NLDEV, RDMA_NLDEV_CMD_RES_GET), |
| 1365 | 1373 | 0, NLM_F_MULTI); |
| 1366 | 1374 | |
| 1367 | | − if (!nlh || fill_res_info(skb, device)) { |
| 1375 | + if (!nlh || fill_res_info(skb, device, false)) { |
| 1368 | 1376 | nlmsg_cancel(skb, nlh); |
| 1369 | 1377 | goto out; |
| 1370 | 1378 | } |
| @@ -1534,6 +1542,7 @@ static int res_get_common_dumpit(struct sk_buff *skb, · 163 unmodified lines |
| 1534 | 1542 | struct rdma_restrack_entry *res; |
| 1535 | 1543 | struct rdma_restrack_root *rt; |
| 1536 | 1544 | int err, ret = 0, idx = 0; |
| 1545 | + bool show_details = false; |
| 1537 | 1546 | struct nlattr *table_attr; |
| 1538 | 1547 | struct nlattr *entry_attr; |
| 1539 | 1548 | struct ib_device *device; |
| @@ -1562,6 +1571,9 @@ static int res_get_common_dumpit(struct sk_buff *skb, · 22 unmodified lines |
| 1562 | 1571 | if (!device) |
| 1563 | 1572 | return -EINVAL; |
| 1564 | 1573 | |
| 1574 | + if (tb[RDMA_NLDEV_ATTR_DRIVER_DETAILS]) |
| 1575 | + show_details = nla_get_u8(tb[RDMA_NLDEV_ATTR_DRIVER_DETAILS]); |
| 1576 | + |
| 1565 | 1577 | /* |
| 1566 | 1578 | * If no PORT_INDEX is supplied, we will return all QPs from that device |
| 1567 | 1579 | */ |
| @@ -1599,6 +1611,9 @@ static int res_get_common_dumpit(struct sk_buff *skb, · 31 unmodified lines |
| 1599 | 1611 | * objects. |
| 1600 | 1612 | */ |
| 1601 | 1613 | xa_for_each(&rt->xa, id, res) { |
| 1614 | + if (xa_get_mark(&rt->xa, res->id, RESTRACK_DD) && !show_details) |
| 1615 | + goto next; |
| 1616 | + |
| 1602 | 1617 | if (idx < start || !rdma_restrack_get(res)) |
| 1603 | 1618 | goto next; |
| 1604 | 1619 | |