[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20211008104322.1328193-1-jacob.e.keller@intel.com>
Date: Fri, 8 Oct 2021 03:43:22 -0700
From: Jacob Keller <jacob.e.keller@...el.com>
To: netdev@...r.kernel.org
Cc: Jiri Pirko <jiri@...nulli.us>, Jakub Kicinski <kubakici@...pl>,
Jacob Keller <jacob.e.keller@...el.com>
Subject: [PATCH iproute2-next] devlink: add dry run attribute support to devlink flash
Signed-off-by: Jacob Keller <jacob.e.keller@...el.com>
---
This requires updated kernel headers which have the DEVLINK_ATTR_DRY_RUN.
devlink/devlink.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/devlink/devlink.c b/devlink/devlink.c
index 07c4e08ab9d8..54ab5855c466 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -294,6 +294,7 @@ static void ifname_map_free(struct ifname_map *ifname_map)
#define DL_OPT_PORT_FN_RATE_TX_MAX BIT(49)
#define DL_OPT_PORT_FN_RATE_NODE_NAME BIT(50)
#define DL_OPT_PORT_FN_RATE_PARENT BIT(51)
+#define DL_OPT_DRY_RUN BIT(52)
struct dl_opts {
uint64_t present; /* flags of present items */
@@ -692,6 +693,7 @@ static const enum mnl_attr_data_type devlink_policy[DEVLINK_ATTR_MAX + 1] = {
[DEVLINK_ATTR_TRAP_POLICER_ID] = MNL_TYPE_U32,
[DEVLINK_ATTR_TRAP_POLICER_RATE] = MNL_TYPE_U64,
[DEVLINK_ATTR_TRAP_POLICER_BURST] = MNL_TYPE_U64,
+ [DEVLINK_ATTR_DRY_RUN] = MNL_TYPE_FLAG,
};
static const enum mnl_attr_data_type
@@ -2063,6 +2065,10 @@ static int dl_argv_parse(struct dl *dl, uint64_t o_required,
dl_arg_inc(dl);
opts->rate_parent_node = "";
o_found |= DL_OPT_PORT_FN_RATE_PARENT;
+ } else if (dl_argv_match(dl, "dry_run") &&
+ (o_all & DL_OPT_DRY_RUN)) {
+ dl_arg_inc(dl);
+ o_found |= DL_OPT_DRY_RUN;
} else {
pr_err("Unknown option \"%s\"\n", dl_argv(dl));
return -EINVAL;
@@ -2141,6 +2147,8 @@ static void dl_opts_put(struct nlmsghdr *nlh, struct dl *dl)
mnl_attr_put_strz(nlh, DEVLINK_ATTR_RATE_NODE_NAME,
opts->rate_node_name);
}
+ if (opts->present & DL_OPT_DRY_RUN)
+ mnl_attr_put(nlh, DEVLINK_ATTR_DRY_RUN, 0, NULL);
if (opts->present & DL_OPT_PORT_TYPE)
mnl_attr_put_u16(nlh, DEVLINK_ATTR_PORT_TYPE,
opts->port_type);
@@ -3893,7 +3901,8 @@ static int cmd_dev_flash(struct dl *dl)
NLM_F_REQUEST | NLM_F_ACK);
err = dl_argv_parse_put(nlh, dl, DL_OPT_HANDLE | DL_OPT_FLASH_FILE_NAME,
- DL_OPT_FLASH_COMPONENT | DL_OPT_FLASH_OVERWRITE);
+ DL_OPT_FLASH_COMPONENT | DL_OPT_FLASH_OVERWRITE |
+ DL_OPT_DRY_RUN);
if (err)
return err;
base-commit: b840c620fe818a313f09891cd2ede492e928e8d4
prerequisite-patch-id: 9f39ea2aae6d14f30d67aa30209939e7afb3dc87
--
2.31.1
Powered by blists - more mailing lists