Skip to content

Commit c0ef144

Browse files
ivecerakuba-moo
authored andcommitted
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>
1 parent 9f149c5 commit c0ef144

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

include/net/devlink.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,7 @@ enum devlink_param_type {
425425
DEVLINK_PARAM_TYPE_U8 = DEVLINK_VAR_ATTR_TYPE_U8,
426426
DEVLINK_PARAM_TYPE_U16 = DEVLINK_VAR_ATTR_TYPE_U16,
427427
DEVLINK_PARAM_TYPE_U32 = DEVLINK_VAR_ATTR_TYPE_U32,
428+
DEVLINK_PARAM_TYPE_U64 = DEVLINK_VAR_ATTR_TYPE_U64,
428429
DEVLINK_PARAM_TYPE_STRING = DEVLINK_VAR_ATTR_TYPE_STRING,
429430
DEVLINK_PARAM_TYPE_BOOL = DEVLINK_VAR_ATTR_TYPE_FLAG,
430431
};
@@ -433,6 +434,7 @@ union devlink_param_value {
433434
u8 vu8;
434435
u16 vu16;
435436
u32 vu32;
437+
u64 vu64;
436438
char vstr[__DEVLINK_PARAM_MAX_STRING_VALUE];
437439
bool vbool;
438440
};

net/devlink/param.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,11 @@ devlink_nl_param_value_fill_one(struct sk_buff *msg,
200200
if (nla_put_u32(msg, DEVLINK_ATTR_PARAM_VALUE_DATA, val.vu32))
201201
goto value_nest_cancel;
202202
break;
203+
case DEVLINK_PARAM_TYPE_U64:
204+
if (devlink_nl_put_u64(msg, DEVLINK_ATTR_PARAM_VALUE_DATA,
205+
val.vu64))
206+
goto value_nest_cancel;
207+
break;
203208
case DEVLINK_PARAM_TYPE_STRING:
204209
if (nla_put_string(msg, DEVLINK_ATTR_PARAM_VALUE_DATA,
205210
val.vstr))
@@ -434,6 +439,11 @@ devlink_param_value_get_from_info(const struct devlink_param *param,
434439
return -EINVAL;
435440
value->vu32 = nla_get_u32(param_data);
436441
break;
442+
case DEVLINK_PARAM_TYPE_U64:
443+
if (nla_len(param_data) != sizeof(u64))
444+
return -EINVAL;
445+
value->vu64 = nla_get_u64(param_data);
446+
break;
437447
case DEVLINK_PARAM_TYPE_STRING:
438448
len = strnlen(nla_data(param_data), nla_len(param_data));
439449
if (len == nla_len(param_data) ||

0 commit comments

Comments
 (0)