[PATCH iproute2-next v3 1/2] devlink: use DEVLINK_VAR_ATTR_TYPE_* in param show/set
From: Ratheesh Kannoth <hidden>
Date: 2026-07-01 03:14:19
Also in:
lkml
Subsystem:
the rest · Maintainer:
Linus Torvalds
Replace MNL_TYPE_* constants with DEVLINK_VAR_ATTR_TYPE_* when handling DEVLINK_ATTR_PARAM_TYPE in param value display and set paths. The kernel uAPI now exposes these values directly via devlink_var_attr_type. Signed-off-by: Ratheesh Kannoth <redacted> --- devlink/devlink.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/devlink/devlink.c b/devlink/devlink.c
index 434a91fe..803ea5d7 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c@@ -3526,7 +3526,7 @@ static int pr_out_param_value_print(const char *nla_name, int nla_type, print_string(PRINT_FP, NULL, " %s ", label); switch (nla_type) { - case MNL_TYPE_U8: + case DEVLINK_VAR_ATTR_TYPE_U8: if (conv_exists) { err = param_val_conv_str_get(param_val_conv, PARAM_VAL_CONV_LEN,
@@ -3541,7 +3541,7 @@ static int pr_out_param_value_print(const char *nla_name, int nla_type, mnl_attr_get_u8(val_attr)); } break; - case MNL_TYPE_U16: + case DEVLINK_VAR_ATTR_TYPE_U16: if (conv_exists) { err = param_val_conv_str_get(param_val_conv, PARAM_VAL_CONV_LEN,
@@ -3556,7 +3556,7 @@ static int pr_out_param_value_print(const char *nla_name, int nla_type, mnl_attr_get_u16(val_attr)); } break; - case MNL_TYPE_U32: + case DEVLINK_VAR_ATTR_TYPE_U32: if (conv_exists) { err = param_val_conv_str_get(param_val_conv, PARAM_VAL_CONV_LEN,
@@ -3571,11 +3571,11 @@ static int pr_out_param_value_print(const char *nla_name, int nla_type, mnl_attr_get_u32(val_attr)); } break; - case MNL_TYPE_STRING: + case DEVLINK_VAR_ATTR_TYPE_STRING: print_string(PRINT_ANY, label, "%s", mnl_attr_get_str(val_attr)); break; - case MNL_TYPE_FLAG: + case DEVLINK_VAR_ATTR_TYPE_FLAG: if (flag_as_u8) print_bool(PRINT_ANY, label, "%s", mnl_attr_get_u8(val_attr));
@@ -3753,22 +3753,22 @@ static int cmd_dev_param_set_cb(const struct nlmsghdr *nlh, void *data) ctx->cmode_found = true; val_attr = nla_value[DEVLINK_ATTR_PARAM_VALUE_DATA]; switch (nla_type) { - case MNL_TYPE_U8: + case DEVLINK_VAR_ATTR_TYPE_U8: ctx->value.vu8 = mnl_attr_get_u8(val_attr); break; - case MNL_TYPE_U16: + case DEVLINK_VAR_ATTR_TYPE_U16: ctx->value.vu16 = mnl_attr_get_u16(val_attr); break; - case MNL_TYPE_U32: + case DEVLINK_VAR_ATTR_TYPE_U32: ctx->value.vu32 = mnl_attr_get_u32(val_attr); break; - case MNL_TYPE_U64: + case DEVLINK_VAR_ATTR_TYPE_U64: ctx->value.vu64 = mnl_attr_get_u64(val_attr); break; - case MNL_TYPE_STRING: + case DEVLINK_VAR_ATTR_TYPE_STRING: ctx->value.vstr = mnl_attr_get_str(val_attr); break; - case MNL_TYPE_FLAG: + case DEVLINK_VAR_ATTR_TYPE_FLAG: ctx->value.vbool = val_attr ? true : false; break; }
@@ -3841,7 +3841,7 @@ static int cmd_dev_param_set(struct dl *dl) mnl_attr_put_u8(nlh, DEVLINK_ATTR_PARAM_TYPE, ctx.nla_type); switch (ctx.nla_type) { - case MNL_TYPE_U8: + case DEVLINK_VAR_ATTR_TYPE_U8: if (conv_exists) { err = param_val_conv_uint_get(param_val_conv, PARAM_VAL_CONV_LEN,
@@ -3858,7 +3858,7 @@ static int cmd_dev_param_set(struct dl *dl) return 0; mnl_attr_put_u8(nlh, DEVLINK_ATTR_PARAM_VALUE_DATA, val_u8); break; - case MNL_TYPE_U16: + case DEVLINK_VAR_ATTR_TYPE_U16: if (conv_exists) { err = param_val_conv_uint_get(param_val_conv, PARAM_VAL_CONV_LEN,
@@ -3875,7 +3875,7 @@ static int cmd_dev_param_set(struct dl *dl) return 0; mnl_attr_put_u16(nlh, DEVLINK_ATTR_PARAM_VALUE_DATA, val_u16); break; - case MNL_TYPE_U32: + case DEVLINK_VAR_ATTR_TYPE_U32: if (conv_exists) { err = param_val_conv_uint_get(param_val_conv, PARAM_VAL_CONV_LEN,
@@ -3892,7 +3892,7 @@ static int cmd_dev_param_set(struct dl *dl) return 0; mnl_attr_put_u32(nlh, DEVLINK_ATTR_PARAM_VALUE_DATA, val_u32); break; - case MNL_TYPE_U64: + case DEVLINK_VAR_ATTR_TYPE_U64: if (conv_exists) err = param_val_conv_uint_get(param_val_conv, PARAM_VAL_CONV_LEN,
@@ -3907,7 +3907,7 @@ static int cmd_dev_param_set(struct dl *dl) return 0; mnl_attr_put_u64(nlh, DEVLINK_ATTR_PARAM_VALUE_DATA, val_u64); break; - case MNL_TYPE_FLAG: + case DEVLINK_VAR_ATTR_TYPE_FLAG: err = str_to_bool(dl->opts.param_value, &val_bool); if (err) goto err_param_value_parse;
@@ -3917,7 +3917,7 @@ static int cmd_dev_param_set(struct dl *dl) mnl_attr_put(nlh, DEVLINK_ATTR_PARAM_VALUE_DATA, 0, NULL); break; - case MNL_TYPE_STRING: + case DEVLINK_VAR_ATTR_TYPE_STRING: mnl_attr_put_strz(nlh, DEVLINK_ATTR_PARAM_VALUE_DATA, dl->opts.param_value); if (!strcmp(dl->opts.param_value, ctx.value.vstr))
--
2.43.0