* [PATCH iproute2-next] devlink: support direct region read requests
@ 2022-11-28 20:42 Jacob Keller
2022-12-03 18:02 ` David Ahern
0 siblings, 1 reply; 2+ messages in thread
From: Jacob Keller @ 2022-11-28 20:42 UTC (permalink / raw)
To: netdev; +Cc: Jiri Pirko, Jacob Keller
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>
---
This depends on https://lore.kernel.org/netdev/20221128203647.1198669-1-jacob.e.keller@intel.com/T/#t
devlink/devlink.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/devlink/devlink.c b/devlink/devlink.c
index 8aefa101b2f8..5057b09505ef 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -8535,11 +8535,15 @@ 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;
+ /* 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);
+
nlh = mnlu_gen_socket_cmd_prepare(&dl->nlg, DEVLINK_CMD_REGION_READ,
NLM_F_REQUEST | NLM_F_ACK | NLM_F_DUMP);
base-commit: 2ed09c3bf8aca185b2f3eb369ae435503f9b9826
--
2.38.1.420.g319605f8f00e
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH iproute2-next] devlink: support direct region read requests
2022-11-28 20:42 [PATCH iproute2-next] devlink: support direct region read requests Jacob Keller
@ 2022-12-03 18:02 ` David Ahern
0 siblings, 0 replies; 2+ messages in thread
From: David Ahern @ 2022-12-03 18:02 UTC (permalink / raw)
To: Jacob Keller; +Cc: netdev, Jiri Pirko
> diff --git a/devlink/devlink.c b/devlink/devlink.c
> index 8aefa101b2f8..5057b09505ef 100644
> --- a/devlink/devlink.c
> +++ b/devlink/devlink.c
> @@ -8535,11 +8535,15 @@ 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;
>
> + /* 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);
> +
> nlh = mnlu_gen_socket_cmd_prepare(&dl->nlg, DEVLINK_CMD_REGION_READ,
> NLM_F_REQUEST | NLM_F_ACK | NLM_F_DUMP);
>
>
> base-commit: 2ed09c3bf8aca185b2f3eb369ae435503f9b9826
> --
> 2.38.1.420.g319605f8f00e
>
This introduces a compile warning:
devlink.c: In function ‘dl_cmd’:
devlink.c:8613:3: warning: ‘nlh’ may be used uninitialized in this function [-Wmaybe-uninitialized]
8613 | mnl_attr_put(nlh, DEVLINK_ATTR_REGION_DIRECT, 0, NULL);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
devlink.c:8602:19: note: ‘nlh’ was declared here
and always add maintainers to iproute2 patches.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-12-03 18:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-28 20:42 [PATCH iproute2-next] devlink: support direct region read requests Jacob Keller
2022-12-03 18:02 ` David Ahern
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).