summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Vecera <ivecera@redhat.com>2025-07-04 20:21:53 +0200
committerJakub Kicinski <kuba@kernel.org>2025-07-09 19:08:52 -0700
commitc0ef1446959101d23fdf1b1bdefc6613a83dba03 (patch)
tree032601022ca0cca606e964fd4b237c7d2801ca5b
parent9f149c5d6dbe3b9b54704a6f342958ef28392dd0 (diff)
devlink: Add support for u64 parameters
Only 8, 16 and 32-bit integers are supported for numeric devlink parameters. The subsequent patch adds support for DPLL clock ID that is defined as 64-bit number. Add support for u64 parameter type. Signed-off-by: Ivan Vecera <ivecera@redhat.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Link: https://patch.msgid.link/20250704182202.1641943-4-ivecera@redhat.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r--include/net/devlink.h2
-rw-r--r--net/devlink/param.c10
2 files changed, 12 insertions, 0 deletions
diff --git a/include/net/devlink.h b/include/net/devlink.h
index d0ce5a7e984c..4a5896b846a4 100644
--- a/include/net/devlink.h
+++ b/include/net/devlink.h
@@ -425,6 +425,7 @@ enum devlink_param_type {
DEVLINK_PARAM_TYPE_U8 = DEVLINK_VAR_ATTR_TYPE_U8,
DEVLINK_PARAM_TYPE_U16 = DEVLINK_VAR_ATTR_TYPE_U16,
DEVLINK_PARAM_TYPE_U32 = DEVLINK_VAR_ATTR_TYPE_U32,
+ DEVLINK_PARAM_TYPE_U64 = DEVLINK_VAR_ATTR_TYPE_U64,
DEVLINK_PARAM_TYPE_STRING = DEVLINK_VAR_ATTR_TYPE_STRING,
DEVLINK_PARAM_TYPE_BOOL = DEVLINK_VAR_ATTR_TYPE_FLAG,
};
@@ -433,6 +434,7 @@ union devlink_param_value {
u8 vu8;
u16 vu16;
u32 vu32;
+ u64 vu64;
char vstr[__DEVLINK_PARAM_MAX_STRING_VALUE];
bool vbool;
};
diff --git a/net/devlink/param.c b/net/devlink/param.c
index 396b8a7f6013..9709b41664aa 100644
--- a/net/devlink/param.c
+++ b/net/devlink/param.c
@@ -200,6 +200,11 @@ devlink_nl_param_value_fill_one(struct sk_buff *msg,
if (nla_put_u32(msg, DEVLINK_ATTR_PARAM_VALUE_DATA, val.vu32))
goto value_nest_cancel;
break;
+ case DEVLINK_PARAM_TYPE_U64:
+ if (devlink_nl_put_u64(msg, DEVLINK_ATTR_PARAM_VALUE_DATA,
+ val.vu64))
+ goto value_nest_cancel;
+ break;
case DEVLINK_PARAM_TYPE_STRING:
if (nla_put_string(msg, DEVLINK_ATTR_PARAM_VALUE_DATA,
val.vstr))
@@ -434,6 +439,11 @@ devlink_param_value_get_from_info(const struct devlink_param *param,
return -EINVAL;
value->vu32 = nla_get_u32(param_data);
break;
+ case DEVLINK_PARAM_TYPE_U64:
+ if (nla_len(param_data) != sizeof(u64))
+ return -EINVAL;
+ value->vu64 = nla_get_u64(param_data);
+ break;
case DEVLINK_PARAM_TYPE_STRING:
len = strnlen(nla_data(param_data), nla_len(param_data));
if (len == nla_len(param_data) ||