Skip to contentSkip to conversation

libmnl: add MNL_TYPE_UARR for devlink u64 array attributes

PATCH In review Ratheesh Kannoth 2 participants 5 messages Jun 23 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libmnl: add MNL_TYPE_UARR for devlink u64 array attributes

Add MNL_TYPE_UARR (129) to enum mnl_attr_data_type to match DEVLINK_VAR_ATTR_TYPE_U64_ARRAY in the kernel. That type represents devlink param values encoded as a nested list of u64 attributes in DEVLINK_ATTR_PARAM_VALUE_DATA, allowing drivers and userspace to exchange variable-length u64/u32 arrays (e.g. multi-value devlink params).

---
 include/libmnl/libmnl.h | 1 +
 1 file changed, 1 insertion(+)
include/libmnl/libmnl.h +1 -0
index 0331da7..078d517 100644
@@ -133,6 +133,7 @@ enum mnl_attr_data_type {
 	MNL_TYPE_NESTED_COMPAT,
 	MNL_TYPE_NUL_STRING,
 	MNL_TYPE_BINARY,
+	MNL_TYPE_UARR = 129,
 	MNL_TYPE_MAX,
 };
 
Signature · 1 line
2.43.0
#1 lore raw
Quoted 16 lines · Ratheesh Kannoth

Add MNL_TYPE_UARR (129) to enum mnl_attr_data_type to match DEVLINK_VAR_ATTR_TYPE_U64_ARRAY in the kernel. That type represents devlink param values encoded as a nested list of u64 attributes in DEVLINK_ATTR_PARAM_VALUE_DATA, allowing drivers and userspace to exchange variable-length u64/u32 arrays (e.g. multi-value devlink params).

---
 include/libmnl/libmnl.h | 1 +
 1 file changed, 1 insertion(+)
include/libmnl/libmnl.h +0 -0
index 0331da7..078d517 100644

include/libmnl/libmnl.h enum mnl_attr_data_type { · line 136

Quoted 4 lines
include/libmnl/libmnl.h +1 -0
@@ -133,6 +133,7 @@ enum mnl_attr_data_type {
 	MNL_TYPE_NESTED_COMPAT,
 	MNL_TYPE_NUL_STRING,
 	MNL_TYPE_BINARY,
+	MNL_TYPE_UARR = 129,

Why 129?

Quoted 7 lines
include/libmnl/libmnl.h +0 -0
 	MNL_TYPE_MAX,
 };
 
Signature · 1 line
2.43.0
#2 lore raw

RE:: Re: [PATCH] libmnl: add MNL_TYPE_UARR for devlink u64 array attributes

From: Pablo Neira Ayuso <[email protected]>
Subject: [EXTERNAL] Re: [PATCH] libmnl: add MNL_TYPE_UARR for devlink u64 array attributes

include/libmnl/libmnl.h enum mnl_attr_data_type { · line 136

Quoted 12 lines
 include/libmnl/libmnl.h | 1 +
 1 file changed, 1 insertion(+)
include/libmnl/libmnl.h +1 -0
index 0331da7..078d517 100644
@@ -133,6 +133,7 @@ enum mnl_attr_data_type {
 	MNL_TYPE_NESTED_COMPAT,
 	MNL_TYPE_NUL_STRING,
 	MNL_TYPE_BINARY,
+	MNL_TYPE_UARR = 129,

Why 129?

include/libmnl/libmnl.h enum mnl_attr_data_type { · line 138

Quoted 2 lines
include/libmnl/libmnl.h +0 -0
 	MNL_TYPE_MAX,
 };

I would like to merge https://patchwork.kernel.org/project/netdevbpf/patch/[email protected]/
But this has a hard coded value 129. I believe, I need to use a macro here instead of 129.

The value 129 is based on __DEVLINK_VAR_ATTR_TYPE_CUSTOM_BASE = 0x80 (i.e., 128) defined in the kernel, with custom types starting at that offset. The relevant kernel-side definition is:

  @@ -406,6 +406,7 @@ enum devlink_var_attr_type {
          DEVLINK_VAR_ATTR_TYPE_BINARY,
          _DEVLINK_VAR_ATTR_TYPE_CUSTOM_BASE = 0x80,
          /* Any possible custom types, unrelated to NLA* values go below */
           DEVLINK_VAR_ATTR_TYPE_U64_ARRAY,

};
So DEVLINK_VAR_ATTR_TYPE_U64_ARRAY resolves to 0x81 = 129. Please see the kernel patch for full context:
https://lore.kernel.org/all/[email protected]/

Once this libmnl patch is merged, I will update the hardcoded 129 to use MNL_TYPE_UARR in:
https://patchwork.kernel.org/project/netdevbpf/patch/[email protected]/

Thanks,
Ratheesh

#3 lore raw

Re: : Re: [PATCH] libmnl: add MNL_TYPE_UARR for devlink u64 array attributes

Quoted 30 lines · Ratheesh Kannoth

From: Pablo Neira Ayuso <[email protected]>
Subject: [EXTERNAL] Re: [PATCH] libmnl: add MNL_TYPE_UARR for devlink u64 array attributes

include/libmnl/libmnl.h enum mnl_attr_data_type { · line 136

Quoted 12 lines
 include/libmnl/libmnl.h | 1 +
 1 file changed, 1 insertion(+)
include/libmnl/libmnl.h +1 -0
index 0331da7..078d517 100644
@@ -133,6 +133,7 @@ enum mnl_attr_data_type {
 	MNL_TYPE_NESTED_COMPAT,
 	MNL_TYPE_NUL_STRING,
 	MNL_TYPE_BINARY,
+	MNL_TYPE_UARR = 129,

Why 129?

include/libmnl/libmnl.h enum mnl_attr_data_type { · line 138

Quoted 2 lines
include/libmnl/libmnl.h +0 -0
 	MNL_TYPE_MAX,
 };

I would like to merge https://patchwork.kernel.org/project/netdevbpf/patch/[email protected]/
But this has a hard coded value 129. I believe, I need to use a macro here instead of 129.

The value 129 is based on __DEVLINK_VAR_ATTR_TYPE_CUSTOM_BASE = 0x80 (i.e., 128) defined in the kernel, with custom types starting at that offset. The relevant kernel-side definition is:

  @@ -406,6 +406,7 @@ enum devlink_var_attr_type {
          DEVLINK_VAR_ATTR_TYPE_BINARY,
          _DEVLINK_VAR_ATTR_TYPE_CUSTOM_BASE = 0x80,
          /* Any possible custom types, unrelated to NLA* values go below */
           DEVLINK_VAR_ATTR_TYPE_U64_ARRAY,
Quoted 8 lines

};
So DEVLINK_VAR_ATTR_TYPE_U64_ARRAY resolves to 0x81 = 129. Please see the kernel patch for full context:
https://lore.kernel.org/all/[email protected]/

Once this libmnl patch is merged, I will update the hardcoded 129 to use MNL_TYPE_UARR in:
https://patchwork.kernel.org/project/netdevbpf/patch/[email protected]/

This value is only internal for __mnl_attr_validate(), this validates the attribute type.

I think this is not what you're searching for...

#4 lore raw

RE: [EXTERNAL] Re: : Re: [PATCH] libmnl: add MNL_TYPE_UARR for devlink u64 array attributes

From: Pablo Neira Ayuso <[email protected]>
Sent: Tuesday, June 23, 2026 4:32 PM
To: Ratheesh Kannoth <[email protected]>
Cc: [email protected]
Subject: [EXTERNAL] Re: : Re: [PATCH] libmnl: add MNL_TYPE_UARR for devlink u64 array attributes

Quoted 8 lines
Quoted 3 lines

Once this libmnl patch is merged, I will update the hardcoded 129 to use MNL_TYPE_UARR in:
https://urldefense.proofpoint.com/v2/url?u=https-3A__patchwork.kernel.org_project_netdevbpf_patch_20260615041042.549715-2D1-2Drkannoth-40marvell.com_&d=DwIBaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=aekcsyBCH00_LewrEDcQBzsRw8KCpUR0vZb_auTHk4M&m=wDiuehWQ149iF11smw-oJ->2DYcumcZ2p_TOt6cZjNrBIJEpJGcHrMnzaoJlDSDV5&s=4llebXoU9zDF5M9XK5vZ9LNM-Jq-kaCIiBUpfqfZeqg&e=

This value is only internal for __mnl_attr_validate(), this validates the attribute type.

I think this is not what you're searching for...

Thank you !. You are right. Please abandon the patch.