netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next] devlink: report maximum number of snapshots with regions
@ 2021-09-30 21:21 Jacob Keller
  2021-10-01  0:05 ` Jakub Kicinski
  2021-10-01 13:50 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Jacob Keller @ 2021-09-30 21:21 UTC (permalink / raw)
  To: netdev; +Cc: Jakub Kicinski, Jiri Pirko, Jacob Keller, Gurucharan G

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>
---
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(-)

diff --git a/Documentation/networking/devlink/devlink-region.rst b/Documentation/networking/devlink/devlink-region.rst
index 58fe95e9a49d..f06dca9a1eb6 100644
--- a/Documentation/networking/devlink/devlink-region.rst
+++ b/Documentation/networking/devlink/devlink-region.rst
@@ -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
diff --git a/Documentation/networking/devlink/ice.rst b/Documentation/networking/devlink/ice.rst
index a432dc419fa4..32aea1f7d7f7 100644
--- a/Documentation/networking/devlink/ice.rst
+++ b/Documentation/networking/devlink/ice.rst
@@ -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
 
diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h
index 32f53a0069d6..b897b80770f6 100644
--- a/include/uapi/linux/devlink.h
+++ b/include/uapi/linux/devlink.h
@@ -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,
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;

base-commit: b05173028cc52384be42dcf81abdb4133caccfa5
-- 
2.31.1.331.gb0c09ab8796f


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [net-next] devlink: report maximum number of snapshots with regions
  2021-09-30 21:21 [net-next] devlink: report maximum number of snapshots with regions Jacob Keller
@ 2021-10-01  0:05 ` Jakub Kicinski
  2021-10-01 13:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2021-10-01  0:05 UTC (permalink / raw)
  To: Jacob Keller; +Cc: netdev, Jiri Pirko, Gurucharan G

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_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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [net-next] devlink: report maximum number of snapshots with regions
  2021-09-30 21:21 [net-next] devlink: report maximum number of snapshots with regions Jacob Keller
  2021-10-01  0:05 ` Jakub Kicinski
@ 2021-10-01 13:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-10-01 13:50 UTC (permalink / raw)
  To: Keller, Jacob E; +Cc: netdev, kubakici, jiri, gurucharanx.g

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

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_SNAPSHOST attribute 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



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-10-01 13:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-30 21:21 [net-next] devlink: report maximum number of snapshots with regions Jacob Keller
2021-10-01  0:05 ` Jakub Kicinski
2021-10-01 13:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).