History

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.

Jiri Pirko committed 1 year ago

Commit 429ac621 parent 37006af5 files · +97 −18Browse files

Showing the changes to include/uapi (1 of 5 files). Show all

Unified · Split

include/uapi/linux/devlink.h+15−0
@@ -385,6 +385,21 @@ enum devlink_linecard_state { · 384 unmodified lines
385385 DEVLINK_LINECARD_STATE_MAX = __DEVLINK_LINECARD_STATE_MAX - 1
386386 };
387387
388+/* Variable attribute type. */
389+enum devlink_var_attr_type {
390+ /* Following values relate to the internal NLA_* values */
391+ DEVLINK_VAR_ATTR_TYPE_U8 = 1,
392+ DEVLINK_VAR_ATTR_TYPE_U16,
393+ DEVLINK_VAR_ATTR_TYPE_U32,
394+ DEVLINK_VAR_ATTR_TYPE_U64,
395+ DEVLINK_VAR_ATTR_TYPE_STRING,
396+ DEVLINK_VAR_ATTR_TYPE_FLAG,
397+ DEVLINK_VAR_ATTR_TYPE_NUL_STRING = 10,
398+ DEVLINK_VAR_ATTR_TYPE_BINARY,
399+ __DEVLINK_VAR_ATTR_TYPE_CUSTOM_BASE = 0x80,
400+ /* Any possible custom types, unrelated to NLA_* values go below */
401+};
402+
388403 enum devlink_attr {
389404 /* don't change the order or add anything between, this is ABI! */
390405 DEVLINK_ATTR_UNSPEC,