[PATCH iproute2-next v2 1/2] devlink: use DEVLINK_VAR_ATTR_TYPE_* in param show/set
From: Ratheesh Kannoth
Date: Mon Jun 29 2026 - 21:57:22 EST
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 <rkannoth@xxxxxxxxxxx>
---
devlink/devlink.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/devlink/devlink.c b/devlink/devlink.c
index b4deba30..9372e92f 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -3507,7 +3507,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,
@@ -3522,7 +3522,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,
@@ -3537,7 +3537,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,
@@ -3552,11 +3552,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));
@@ -3822,7 +3822,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,
@@ -3839,7 +3839,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,
@@ -3856,7 +3856,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,
@@ -3873,7 +3873,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,
@@ -3888,7 +3888,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;
@@ -3898,7 +3898,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