| @@ -137,6 +137,8 @@ static const struct nla_policy nldev_policy[RDMA_NLDEV_ATTR_MAX] = { · 136 unmodified lines |
| 137 | [RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_NAME]= { .type = NLA_NUL_STRING, | 137 | [RDMA_NLDEV_ATTR_RES_SUMMARY_ENTRY_NAME]= { .type = NLA_NUL_STRING, |
| 138 | .len = RDMA_NLDEV_ATTR_EMPTY_STRING }, | 138 | .len = RDMA_NLDEV_ATTR_EMPTY_STRING }, |
| 139 | [RDMA_NLDEV_ATTR_RES_TYPE] = { .type = NLA_U8 }, | 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 | [RDMA_NLDEV_ATTR_RES_UNSAFE_GLOBAL_RKEY]= { .type = NLA_U32 }, | 142 | [RDMA_NLDEV_ATTR_RES_UNSAFE_GLOBAL_RKEY]= { .type = NLA_U32 }, |
| 141 | [RDMA_NLDEV_ATTR_RES_USECNT] = { .type = NLA_U64 }, | 143 | [RDMA_NLDEV_ATTR_RES_USECNT] = { .type = NLA_U64 }, |
| 142 | [RDMA_NLDEV_ATTR_RES_SRQ] = { .type = NLA_NESTED }, | 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 | [RDMA_NLDEV_ATTR_STAT_HWCOUNTER_INDEX] = { .type = NLA_U32 }, | 166 | [RDMA_NLDEV_ATTR_STAT_HWCOUNTER_INDEX] = { .type = NLA_U32 }, |
| 165 | [RDMA_NLDEV_ATTR_STAT_HWCOUNTER_DYNAMIC] = { .type = NLA_U8 }, | 167 | [RDMA_NLDEV_ATTR_STAT_HWCOUNTER_DYNAMIC] = { .type = NLA_U8 }, |
| 166 | [RDMA_NLDEV_SYS_ATTR_PRIVILEGED_QKEY_MODE] = { .type = NLA_U8 }, | 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 | static int put_driver_name_print_type(struct sk_buff *msg, const char *name, | 172 | static int put_driver_name_print_type(struct sk_buff *msg, const char *name, |
| @@ -399,7 +402,8 @@ err: · 229 unmodified lines |
| 399 | return -EMSGSIZE; | 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 | static const char * const names[RDMA_RESTRACK_MAX] = { | 408 | static const char * const names[RDMA_RESTRACK_MAX] = { |
| 405 | [RDMA_RESTRACK_PD] = "pd", | 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 | for (i = 0; i < RDMA_RESTRACK_MAX; i++) { | 428 | for (i = 0; i < RDMA_RESTRACK_MAX; i++) { |
| 425 | if (!names[i]) | 429 | if (!names[i]) |
| 426 | continue; | 430 | continue; |
| 427 | curr = rdma_restrack_count(device, i); | 431 | curr = rdma_restrack_count(device, i, show_details); |
| 428 | ret = fill_res_info_entry(msg, names[i], curr); | 432 | ret = fill_res_info_entry(msg, names[i], curr); |
| 429 | if (ret) | 433 | if (ret) |
| 430 | goto err; | 434 | goto err; |
| @@ -1305,6 +1309,7 @@ static int nldev_res_get_doit(struct sk_buff *skb, struct nlmsghdr *nlh, · 874 unmodified lines |
| 1305 | struct netlink_ext_ack *extack) | 1309 | struct netlink_ext_ack *extack) |
| 1306 | { | 1310 | { |
| 1307 | struct nlattr *tb[RDMA_NLDEV_ATTR_MAX]; | 1311 | struct nlattr *tb[RDMA_NLDEV_ATTR_MAX]; |
| | 1312 | bool show_details = false; |
| 1308 | struct ib_device *device; | 1313 | struct ib_device *device; |
| 1309 | struct sk_buff *msg; | 1314 | struct sk_buff *msg; |
| 1310 | u32 index; | 1315 | u32 index; |
| @@ -1320,6 +1325,9 @@ static int nldev_res_get_doit(struct sk_buff *skb, struct nlmsghdr *nlh, · 9 unmodified lines |
| 1320 | if (!device) | 1325 | if (!device) |
| 1321 | return -EINVAL; | 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 | msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); | 1331 | msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); |
| 1324 | if (!msg) { | 1332 | if (!msg) { |
| 1325 | ret = -ENOMEM; | 1333 | ret = -ENOMEM; |
| @@ -1334,7 +1342,7 @@ static int nldev_res_get_doit(struct sk_buff *skb, struct nlmsghdr *nlh, · 8 unmodified lines |
| 1334 | goto err_free; | 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 | if (ret) | 1346 | if (ret) |
| 1339 | goto err_free; | 1347 | goto err_free; |
| 1340 | | 1348 | |
| @@ -1364,7 +1372,7 @@ static int _nldev_res_get_dumpit(struct ib_device *device, · 23 unmodified lines |
| 1364 | RDMA_NL_GET_TYPE(RDMA_NL_NLDEV, RDMA_NLDEV_CMD_RES_GET), | 1372 | RDMA_NL_GET_TYPE(RDMA_NL_NLDEV, RDMA_NLDEV_CMD_RES_GET), |
| 1365 | 0, NLM_F_MULTI); | 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 | nlmsg_cancel(skb, nlh); | 1376 | nlmsg_cancel(skb, nlh); |
| 1369 | goto out; | 1377 | goto out; |
| 1370 | } | 1378 | } |
| @@ -1534,6 +1542,7 @@ static int res_get_common_dumpit(struct sk_buff *skb, · 163 unmodified lines |
| 1534 | struct rdma_restrack_entry *res; | 1542 | struct rdma_restrack_entry *res; |
| 1535 | struct rdma_restrack_root *rt; | 1543 | struct rdma_restrack_root *rt; |
| 1536 | int err, ret = 0, idx = 0; | 1544 | int err, ret = 0, idx = 0; |
| | 1545 | bool show_details = false; |
| 1537 | struct nlattr *table_attr; | 1546 | struct nlattr *table_attr; |
| 1538 | struct nlattr *entry_attr; | 1547 | struct nlattr *entry_attr; |
| 1539 | struct ib_device *device; | 1548 | struct ib_device *device; |
| @@ -1562,6 +1571,9 @@ static int res_get_common_dumpit(struct sk_buff *skb, · 22 unmodified lines |
| 1562 | if (!device) | 1571 | if (!device) |
| 1563 | return -EINVAL; | 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 | * If no PORT_INDEX is supplied, we will return all QPs from that device | 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 | * objects. | 1611 | * objects. |
| 1600 | */ | 1612 | */ |
| 1601 | xa_for_each(&rt->xa, id, res) { | 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 | if (idx < start || !rdma_restrack_get(res)) | 1617 | if (idx < start || !rdma_restrack_get(res)) |
| 1603 | goto next; | 1618 | goto next; |
| 1604 | | 1619 | |