devlink: add dry run attribute support to devlink flash
Subsystems (2)
PATCH 1/1 devlink: add dry run attribute support to devlink flash
Signed-off-by Jacob Keller <[email protected]>
---
This requires updated kernel headers which have the DEVLINK_ATTR_DRY_RUN.
devlink/devlink.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
devlink/devlink.c +10 -1
@@ -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
Signature · 1 line
2.31.1