devlink: report maximum number of snapshots with regions
Subsystems (4)
Each region has an independently configurable number of maximum snapshots. This information is not reported to userspace, making it not very discoverable. Fix this by adding a new DEVLINK_ATTR_REGION_MAX_SNAPSHOST attribute which is used to report this maximum.
Ex:
$devlink region
pci/0000:af:00.0/nvm-flash: size 10485760 snapshot [] max 1 pci/0000:af:00.0/device-caps: size 4096 snapshot [] max 10 pci/0000:af:00.1/nvm-flash: size 10485760 snapshot [] max 1 pci/0000:af:00.1/device-caps: size 4096 snapshot [] max 10
This information enables users to understand why a new region command may fail due to having too many existing snapshots.
---
I realized while explaining a new devlink region that there is no mechanism to view the maximum snapshot count for a given region without analyzing the code for a driver. This change fixes that.
Documentation/networking/devlink/devlink-region.rst | 4 ++-- Documentation/networking/devlink/ice.rst | 4 ++++ include/uapi/linux/devlink.h | 2 ++ net/core/devlink.c | 5 +++++ 4 files changed, 13 insertions(+), 2 deletions(-)
Documentation/networking/devlink/devlink-region.rst +2 -2
@@ -44,8 +44,8 @@ example usage # Show all of the exposed regions with region sizes: $ devlink region show - pci/0000:00:05.0/cr-space: size 1048576 snapshot [1 2] - pci/0000:00:05.0/fw-health: size 64 snapshot [1 2] + pci/0000:00:05.0/cr-space: size 1048576 snapshot [1 2] max 8 + pci/0000:00:05.0/fw-health: size 64 snapshot [1 2] max 8 # Delete a snapshot using: $ devlink region del pci/0000:00:05.0/cr-space snapshot 1
Documentation/networking/devlink/ice.rst +4 -0
@@ -141,6 +141,10 @@ Users can request an immediate capture of a snapshot via the .. code:: shell + $ devlink region show + pci/0000:01:00.0/nvm-flash: size 10485760 snapshot [] max 1 + pci/0000:01:00.0/device-caps: size 4096 snapshot [] max 10 + $ devlink region new pci/0000:01:00.0/nvm-flash snapshot 1 $ devlink region dump pci/0000:01:00.0/nvm-flash snapshot 1
include/uapi/linux/devlink.h +2 -0
@@ -551,6 +551,8 @@ enum devlink_attr {DEVLINK_ATTR_RATE_NODE_NAME ,/* string */ DEVLINK_ATTR_RATE_PARENT_NODE_NAME ,/* string */ +DEVLINK_ATTR_REGION_MAX_SNAPSHOTS ,/* u32 */ +/* add new attributes above here, update the policy in devlink.c */ __DEVLINK_ATTR_MAX,
net/core/devlink.c +5 -0
@@ -5078,6 +5078,11 @@ static int devlink_nl_region_fill(struct sk_buff *msg, struct devlink *devlink,if (err) goto nla_put_failure; + err =nla_put_u32 (msg,DEVLINK_ATTR_REGION_MAX_SNAPSHOTS , + region->max_snapshots); +if (err) + goto nla_put_failure; + err =devlink_nl_region_snapshots_id_put (msg, devlink, region);if (err) goto nla_put_failure;
base-commit: b05173028cc52384be42dcf81abdb4133caccfa5
Signature · 1 line
2.31.1.331.gb0c09ab8796f
Quoted 14 lines · On Thu, 30 Sep 2021 14:21:04 -0700 Jacob Keller wrote:
Each region has an independently configurable number of maximum snapshots. This information is not reported to userspace, making it not very discoverable. Fix this by adding a new
DEVLINK_ATTR_REGION_MAX_SNAPSHOSTattribute which is used to report this maximum.Ex:
$devlink region
pci/0000:af:00.0/nvm-flash: size 10485760 snapshot [] max 1 pci/0000:af:00.0/device-caps: size 4096 snapshot [] max 10 pci/0000:af:00.1/nvm-flash: size 10485760 snapshot [] max 1 pci/0000:af:00.1/device-caps: size 4096 snapshot [] max 10
Quoted 5 lines
This information enables users to understand why a new region command may fail due to having too many existing snapshots.
Signed-off-by Jacob Keller <[email protected]>
This patch was applied to netdev/net-next.git (refs/heads/master):
Hello:
This patch was applied to netdev/net-next.git (refs/heads/master):
Quoted 9 lines · On Thu, 30 Sep 2021 14:21:04 -0700 you wrote:
Each region has an independently configurable number of maximum snapshots. This information is not reported to userspace, making it not very discoverable. Fix this by adding a new
DEVLINK_ATTR_REGION_MAX_SNAPSHOSTattribute which is used to report this maximum.Ex:
[...]
Here is the summary with links:
- [net-next] devlink: report maximum number of snapshots with regions
https://git.kernel.org/netdev/net-next/c/a70e3f024d5f
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html