devlink: define enum for attr types of dynamic attributes

Devlink param and health reporter fmsg use attributes with dynamic type
which is determined according to a different type. Currently used values
are NLA_*. The problem is, they are not part of UAPI. They may change
which would cause a break.

To make this future safe, introduce a enum that shadows NLA_* values in
it and is part of UAPI.

Also, this allows to possibly carry types that are unrelated to NLA_*
values.

Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Link: https://patch.msgid.link/20250505114513.53370-3-jiri@resnulli.us
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Jiri Pirko
2025-05-05 13:45:11 +02:00
committed by Jakub Kicinski
parent 37006af675
commit 429ac62114
5 changed files with 97 additions and 18 deletions

View File

@@ -385,6 +385,21 @@ enum devlink_linecard_state {
DEVLINK_LINECARD_STATE_MAX = __DEVLINK_LINECARD_STATE_MAX - 1
};
/* Variable attribute type. */
enum devlink_var_attr_type {
/* Following values relate to the internal NLA_* values */
DEVLINK_VAR_ATTR_TYPE_U8 = 1,
DEVLINK_VAR_ATTR_TYPE_U16,
DEVLINK_VAR_ATTR_TYPE_U32,
DEVLINK_VAR_ATTR_TYPE_U64,
DEVLINK_VAR_ATTR_TYPE_STRING,
DEVLINK_VAR_ATTR_TYPE_FLAG,
DEVLINK_VAR_ATTR_TYPE_NUL_STRING = 10,
DEVLINK_VAR_ATTR_TYPE_BINARY,
__DEVLINK_VAR_ATTR_TYPE_CUSTOM_BASE = 0x80,
/* Any possible custom types, unrelated to NLA_* values go below */
};
enum devlink_attr {
/* don't change the order or add anything between, this is ABI! */
DEVLINK_ATTR_UNSPEC,