History

devlink: Add resource scope filtering to resource dump

Allow filtering the resource dump to device-level or port-level resources using the 'scope' option. Example - dump only device-level resources: $ devlink resource show scope dev pci/0000:03:00.0: name max_local_SFs size 128 unit entry dpipe_tables none name max_external_SFs size 128 unit entry dpipe_tables none pci/0000:03:00.1: name max_local_SFs size 128 unit entry dpipe_tables none name max_external_SFs size 128 unit entry dpipe_tables none Example - dump only port-level resources: $ devlink resource show scope port pci/0000:03:00.0/196608: name max_SFs size 128 unit entry dpipe_tables none pci/0000:03:00.0/196609: name max_SFs size 128 unit entry dpipe_tables none pci/0000:03:00.1/196708: name max_SFs size 128 unit entry dpipe_tables none pci/0000:03:00.1/196709: name max_SFs size 128 unit entry dpipe_tables none

Or Har-Toov committed 7 months ago

Commit 1bc45341 parent 170e1604 files · +55 −4Browse files

Showing the changes to include/uapi (1 of 4 files). Show all

Unified · Split

include/uapi/linux/devlink.h+11−0
@@ -645,6 +645,7 @@ enum devlink_attr { · 644 unmodified lines
645645 DEVLINK_ATTR_PARAM_RESET_DEFAULT, /* flag */
646646
647647 DEVLINK_ATTR_INDEX, /* uint */
648+ DEVLINK_ATTR_RESOURCE_SCOPE_MASK, /* u32 */
648649
649650 /* Add new attributes above here, update the spec in
650651 * Documentation/netlink/specs/devlink.yaml and re-generate
@@ -704,6 +705,16 @@ enum devlink_resource_unit { · 53 unmodified lines
704705 DEVLINK_RESOURCE_UNIT_ENTRY,
705706 };
706707
708+enum devlink_resource_scope {
709+ DEVLINK_RESOURCE_SCOPE_DEV_BIT,
710+ DEVLINK_RESOURCE_SCOPE_PORT_BIT,
711+};
712+
713+#define DEVLINK_RESOURCE_SCOPE_DEV \
714+ _BITUL(DEVLINK_RESOURCE_SCOPE_DEV_BIT)
715+#define DEVLINK_RESOURCE_SCOPE_PORT \
716+ _BITUL(DEVLINK_RESOURCE_SCOPE_PORT_BIT)
717+
707718 enum devlink_port_fn_attr_cap {
708719 DEVLINK_PORT_FN_ATTR_CAP_ROCE_BIT,
709720 DEVLINK_PORT_FN_ATTR_CAP_MIGRATABLE_BIT,