diff mbox series

[iproute2-next,v2,1/1] devlink: support direct region read requests

Message ID 20221205225931.2563966-1-jacob.e.keller@intel.com (mailing list archive)
State Accepted
Commit a74e7181c60b8ffc75503ff7eea7d4a719d636fd
Delegated to: David Ahern
Headers show
Series [iproute2-next,v2,1/1] devlink: support direct region read requests | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Jacob Keller Dec. 5, 2022, 10:59 p.m. UTC
The kernel has gained support for reading from regions without needing to
create a snapshot. To use this support, the DEVLINK_ATTR_REGION_DIRECT
attribute must be added to the command.

For the "read" command, if the user did not specify a snapshot, add the new
attribute to request a direct read. The "dump" command will still require a
snapshot. While technically a dump could be performed without a snapshot it
is not guaranteed to be atomic unless the region size is no larger than
256 bytes.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
Changes since v2:
* Fixed placement of mnl_attr_put
* Added proper Cc's

 devlink/devlink.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org Dec. 8, 2022, 4:30 p.m. UTC | #1
Hello:

This patch was applied to iproute2/iproute2-next.git (main)
by David Ahern <dsahern@kernel.org>:

On Mon,  5 Dec 2022 14:59:31 -0800 you wrote:
> The kernel has gained support for reading from regions without needing to
> create a snapshot. To use this support, the DEVLINK_ATTR_REGION_DIRECT
> attribute must be added to the command.
> 
> For the "read" command, if the user did not specify a snapshot, add the new
> attribute to request a direct read. The "dump" command will still require a
> snapshot. While technically a dump could be performed without a snapshot it
> is not guaranteed to be atomic unless the region size is no larger than
> 256 bytes.
> 
> [...]

Here is the summary with links:
  - [iproute2-next,v2,1/1] devlink: support direct region read requests
    https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=a74e7181c60b

You are awesome, thank you!
diff mbox series

Patch

diff --git a/devlink/devlink.c b/devlink/devlink.c
index 8aefa101b2f8..8d22c141049c 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -8535,8 +8535,8 @@  static int cmd_region_read(struct dl *dl)
 	int err;
 
 	err = dl_argv_parse(dl, DL_OPT_HANDLE_REGION | DL_OPT_REGION_ADDRESS |
-			    DL_OPT_REGION_LENGTH | DL_OPT_REGION_SNAPSHOT_ID,
-			    0);
+			    DL_OPT_REGION_LENGTH,
+			    DL_OPT_REGION_SNAPSHOT_ID);
 	if (err)
 		return err;
 
@@ -8545,6 +8545,10 @@  static int cmd_region_read(struct dl *dl)
 
 	dl_opts_put(nlh, dl);
 
+	/* If user didn't provide a snapshot id, perform a direct read */
+	if (!(dl->opts.present & DL_OPT_REGION_SNAPSHOT_ID))
+		mnl_attr_put(nlh, DEVLINK_ATTR_REGION_DIRECT, 0, NULL);
+
 	pr_out_section_start(dl, "read");
 	err = mnlu_gen_socket_sndrcv(&dl->nlg, nlh, cmd_region_read_cb, dl);
 	pr_out_section_end(dl);