summaryrefslogtreecommitdiff
path: root/net/core
diff options
context:
space:
mode:
authorJacob Keller <jacob.e.keller@intel.com>2021-09-30 14:21:04 -0700
committerDavid S. Miller <davem@davemloft.net>2021-10-01 14:28:55 +0100
commita70e3f024d5f4ec7edb17ab5d927eb55397f1d15 (patch)
treeb117aa9eba12a5fb70559e1562288020564e89f5 /net/core
parent4f42ad2011d2fcbd89f5cdf56121271a8cd5ee5d (diff)
devlink: report maximum number of snapshots with regions
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. Reported-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel) Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Acked-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/devlink.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/net/core/devlink.c b/net/core/devlink.c
index b64303085d0e..4917112406a0 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -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;