uapi: introduce compatibility define of old compilers
cover uapi: introduce compatibility define of old compilers
This series introduces a compatibility define for __counted_by attribute, which is not defined by old compilers. We define is as empty if the compiler don't provide it.
The second patch updates the UAPI headers to v6.19, in which vfio.h introduces the use of this attribute.
Maxime Coquelin (2):
config: add compatibility for old compilers with new UAPI headers
uapi: update headers to v6.19
config/rte_config.h | 9 ++++++++ kernel/linux/uapi/linux/vduse.h | 2 +- kernel/linux/uapi/linux/vfio.h | 40 ++++++++++++++++++++++++++++++++- kernel/linux/uapi/version | 2 +- 4 files changed, 50 insertions(+), 3 deletions(-)
Signature · 1 line
2.55.0
PATCH 1/2 config: add compatibility for old compilers with new UAPI headers
This patch adds a compatibility define for __counted_by attribute, which is not present in older compilers but required for recent UAPI headers like vfio.h.
--- config/rte_config.h | 9 +++++++++ 1 file changed, 9 insertions(+)
config/rte_config.h +9 -0
@@ -25,6 +25,15 @@#define RTE_TOOLCHAIN_MSVC 1#endif +/* +* Compatibility define for Linux kernel UAPI headers that may use __counted_by +* attribute for bounds checking. This attribute is not understood by userspace +* compilers, so define it as empty if not already provided. +*/ +#ifndef __counted_by +#define __counted_by (m) +#endif +/* legacy defines */ #ifdef RTE_EXEC_ENV_LINUX #define RTE_EXEC_ENV_LINUXAPP 1
Signature · 1 line
2.55.0
Re: [PATCH 1/2] config: add compatibility for old compilers with new UAPI headers
Quoted 19 lines · On Wed, 30 Sep 2026 11:57:59 +0200 Maxime Coquelin…
This patch adds a compatibility define for
__counted_byattribute, which is not present in older compilers but required for recent UAPI headers likevfio.h.Signed-off-by Maxime Coquelin <[email protected]>--- config/rte_config.h | 9 +++++++++ 1 file changed, 9 insertions(+)config/rte_config.h +2
-0@@ -25,6 +25,15 @@#define RTE_TOOLCHAIN_MSVC 1#endif +/* +* Compatibility define for Linux kernel UAPI headers that may use __counted_by
config/rte_config.h line 39
Quoted 10 lines
config/rte_config.h +7
-0+* attribute for bounds checking. This attribute is not understood by userspace +* compilers, so define it as empty if not already provided. +*/ +#ifndef __counted_by +#define __counted_by (m) +#endif +/* legacy defines */ #ifdef RTE_EXEC_ENV_LINUX #define RTE_EXEC_ENV_LINUXAPP 1
NAK this is best done by keeping up to date stddef over in virtio headers.
Re: [PATCH 1/2] config: add compatibility for old compilers with new UAPI headers
Quoted 25 lines · Stephen Hemminger
Quoted 14 lines · On Wed, 30 Sep 2026 11:57:59 +0200 Maxime Coquelin…
This patch adds a compatibility define for
__counted_byattribute, which is not present in older compilers but required for recent UAPI headers likevfio.h.Signed-off-by Maxime Coquelin <[email protected]>--- config/rte_config.h | 9 +++++++++ 1 file changed, 9 insertions(+)config/rte_config.h +0
-0config/rte_config.h line 29
Quoted 5 lines
config/rte_config.h +2
-0@@ -25,6 +25,15 @@#define RTE_TOOLCHAIN_MSVC 1#endif +/* +* Compatibility define for Linux kernel UAPI headers that may use
__counted_byconfig/rte_config.h line 30
Quoted 1 line
config/rte_config.h +1
-0+* attribute for bounds checking. This attribute is not understood by userspace
Quoted 13 lines
config/rte_config.h line 39
Quoted 9 lines
config/rte_config.h +6
-0+* compilers, so define it as empty if not already provided. +*/ +#ifndef __counted_by +#define __counted_by (m) +#endif +/* legacy defines */ #ifdef RTE_EXEC_ENV_LINUX #define RTE_EXEC_ENV_LINUXAPP 1NAK this is best done by keeping up to date stddef over in virtio headers.
This is for VFIO, not Virtio but that does not change the issue.
Problem is importing stddef in UAPI as currently done, does not work, because the system version is included first so the imported one is discarded.
An alternative solution I tested would be to include the imported headers first,
but it means imported headers get silently intermixed, which worked in my test
but could lead to hard to debug issues.
While not ideal, the solution proposed in this patch is harmless, we are talking
about an attribute defined as empty.
Thomas, David, what do you think?
Thanks,
Maxime
Re: [PATCH 1/2] config: add compatibility for old compilers with new UAPI headers
Quoted 37 lines · Maxime Coquelin
Quoted 21 lines · Stephen Hemminger
Quoted 17 lines · On Wed, 30 Sep 2026 11:57:59 +0200 Maxime Coquelin…
This patch adds a compatibility define for
__counted_byattribute, which is not present in older compilers but required for recent UAPI headers likevfio.h.Signed-off-by Maxime Coquelin <[email protected]>--- config/rte_config.h | 9 +++++++++ 1 file changed, 9 insertions(+)config/rte_config.h +0
-0@@ -25,6 +25,15 @@#define RTE_TOOLCHAIN_MSVC 1#endif Quoted 14 lines
config/rte_config.h line 39
Quoted 12 lines
config/rte_config.h +9
-0+/* +* Compatibility define for Linux kernel UAPI headers that may use __counted_by +* attribute for bounds checking. This attribute is not understood by userspace +* compilers, so define it as empty if not already provided. +*/ +#ifndef __counted_by +#define __counted_by (m) +#endif +/* legacy defines */ #ifdef RTE_EXEC_ENV_LINUX #define RTE_EXEC_ENV_LINUXAPP 1NAK this is best done by keeping up to date stddef over in virtio headers.
Quoted 8 lines
This is for VFIO, not Virtio but that does not change the issue.
Problem is importing stddef in UAPI as currently done, does not work, because the system version is included first so the imported one is discarded.
An alternative solution I tested would be to include the imported headers first, but it means imported headers get silently intermixed, which worked in my test but could lead to hard to debug issues.
I don't like the alternative, for the reason you listed, plus the fact that this intermixing is invisible.
At the moment, using an imported uapi header is opt-in, and I prefer it like this.
Quoted 2 lines
While not ideal, the solution proposed in this patch is harmless, we are talking about an attribute defined as empty.
Your solution of wrapping __counted_by is simple.
On the other hand, fixing the existing import script would require relying on an external tool (unifef), which could be acceptable. I tried some:
devtools/linux-uapi.sh +4 -0
@@ -13,6 +13,9 @@ file="" check_headers=false quiet=false +# Require unifdef +unifdef -h 2>&1 >/dev/null || { echo "This script requires unifdef."; exit 1; } + print_usage() { echo "Usage: $(basename $0) [-h] [-i FILE] [-u VERSION] [-c] [-q]"
@@ -85,6 +88,9 @@ fixup_includes() sed -i 's|#\(define\)[[:space:]]*_UAPI|#\1 |' $path sed -i 's|#\(endif[[:space:]]*/[*]\)[[:space:]]*_UAPI|#\1 |' $path + unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ -o ${path}.tmp
$path || [ $? -lt 2 ]
+ mv -f ${path}.tmp $path
+
# Prepend include path with "uapi/" if the header is imported for include in $(sed -ne 's/^#include <\(.*\)>$/\1/p' $path); do
if [ -f "$base_path$include" ]; then
(quoted diff) +0 -0
b/doc/guides/contributing/linux_uapi.rst
index b8febfc420..a3490bfbb6 100644
doc/guides/contributing/linux_uapi.rst +2 -0
@@ -27,6 +27,8 @@ Importing or updating an uAPI header file To ensure that imported uAPI headers are unmodified and sourced from an official Linux kernel release, a helper script is provided and must be used. +This script requires the ``unifdef`` tool. + Below is an example to import ``linux/vduse.h`` file from Linux ``v6.10``: .. code-block:: console
Then imported linux/types.h, linux/posix_types.h and linux/stddef.h.
And net/nbl needs some fixing... as it includes uapi/linux/vfio.h too late... Only occurence in the whole DPDK tree:
$ git grep -l '# *include.*uapi' :^devtools/linux-uapi.sh :^doc/guides/contributing/linux_uapi.rst | while read file; do [ $(git grep -B100 '# *include.*uapi' $file | grep '# *include' | wc -l) = 1 ] || echo $file; done drivers/net/nbl/nbl_common/nbl_userdev.c
Signature · 1 line
David Marchand
Re: [PATCH 1/2] config: add compatibility for old compilers with new UAPI headers
Quoted 61 lines · David Marchand
Quoted 1 line · Maxime Coquelin
On Wed, Sep 30, 2026 at 5:26 PM Stephen Hemminger <
Quoted 21 lines · [email protected]> wrote:
Quoted 21 lines
Quoted 17 lines · On Wed, 30 Sep 2026 11:57:59 +0200 Maxime Coquelin…
This patch adds a compatibility define for
__counted_byattribute, which is not present in older compilers but required for recent UAPI headers likevfio.h.Signed-off-by Maxime Coquelin <[email protected]>--- config/rte_config.h | 9 +++++++++ 1 file changed, 9 insertions(+)config/rte_config.h +0
-0@@ -25,6 +25,15 @@#define RTE_TOOLCHAIN_MSVC 1#endif Quoted 2 lines
Quoted 2 lines
config/rte_config.h line 29
Quoted 2 lines
config/rte_config.h +2
-0+/* +* Compatibility define for Linux kernel UAPI headers that may use
__counted_byQuoted 1 line
Quoted 1 line
config/rte_config.h line 30
Quoted 1 line
config/rte_config.h +1
-0+* attribute for bounds checking. This attribute is not understood by userspace
Quoted 11 lines
Quoted 11 lines
config/rte_config.h line 39
Quoted 9 lines
config/rte_config.h +6
-0+* compilers, so define it as empty if not already provided. +*/ +#ifndef __counted_by +#define __counted_by (m) +#endif +/* legacy defines */ #ifdef RTE_EXEC_ENV_LINUX #define RTE_EXEC_ENV_LINUXAPP 1NAK this is best done by keeping up to date stddef over in virtio
headers.
Quoted 5 lines
This is for VFIO, not Virtio but that does not change the issue.
Problem is importing stddef in UAPI as currently done, does not work, because the system version is included first so the imported one is
discarded.
Quoted 2 lines
An alternative solution I tested would be to include the imported
headers first,
Quoted 1 line
but it means imported headers get silently intermixed, which worked in
my test
Quoted 1 line
but could lead to hard to debug issues.
I don't like the alternative, for the reason you listed, plus the fact that this intermixing is invisible.
At the moment, using an imported uapi header is opt-in, and I prefer it like this.
Quoted 9 lines
Quoted 1 line
While not ideal, the solution proposed in this patch is harmless, we are
talking
Quoted 1 line
about an attribute defined as empty.
Your solution of wrapping
__counted_byis simple.On the other hand, fixing the existing import script would require relying on an external tool (unifef), which could be acceptable.
Your solution is certainly more future-proof.
If others agree, can you send a series that supersedes mine so that we can get it merged early?
Eugenio will need to rebase his series on top of it.
Thanks,
Maxime
Quoted 60 lines
I tried some:
devtools/linux-uapi.sh +3
-0@@ -13,6 +13,9 @@ file="" check_headers=false quiet=false +# Require unifdef +unifdef -h 2>&1 >/dev/null || { echo "This script requires unifdef."; exit 1; } + print_usage() {echo "Usage: $(basename $0) [-h] [-i FILE] [-u VERSION] [-c] [-q]"devtools/linux-uapi.sh +1
-0@@ -85,6 +88,9 @@ fixup_includes() sed -i 's|#\(define\)[[:space:]]*_UAPI|#\1 |' $path sed -i 's|#\(endif[[:space:]]*/[*]\)[[:space:]]*_UAPI|#\1 |' $path + unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ -o ${path}.tmp$path || [ $? -lt 2 ]
devtools/linux-uapi.sh +2
-0+ mv -f ${path}.tmp $path + # Prepend include path with "uapi/" if the header is imported for include in $(sed -ne 's/^#include <\(.*\)>$/\1/p' $path); do if [ -f "$base_path$include" ]; thendoc/guides/contributing/linux_uapi.rst +2
-0@@ -27,6 +27,8 @@ Importing or updating an uAPI header file To ensure that imported uAPI headers are unmodified and sourced from an official Linux kernel release, a helper script is provided and must be used. +This script requires the ``unifdef`` tool. + Below is an example to import ``linux/vduse.h`` file from Linux ``v6.10``: .. code-block:: consoleThen imported
linux/types.h,linux/posix_types.handlinux/stddef.h.And net/nbl needs some fixing... as it includes
uapi/linux/vfio.htoo late...
Only occurence in the whole DPDK tree:$ git grep -l '# *include.*uapi' :^devtools/linux-uapi.sh :^doc/guides/contributing/linux_uapi.rst | while read file; do [ $(git grep -B100 '# *include.*uapi' $file | grep '# *include' | wc -l) = 1 ] || echo $file; done drivers/net/nbl/nbl_common/nbl_userdev.c--
David Marchand
PATCH 2/2 uapi: update headers to v6.19
In reply to Maxime CoquelinThis patch updates imported UAPI headers to v6.19, in order to exercise the new compatibility define for __counted_by.
--- kernel/linux/uapi/linux/vduse.h | 2 +- kernel/linux/uapi/linux/vfio.h | 40 ++++++++++++++++++++++++++++++++- kernel/linux/uapi/version | 2 +- 3 files changed, 41 insertions(+), 3 deletions(-)
kernel/linux/uapi/linux/vduse.h +1 -1
@@ -237,7 +237,7 @@ struct vduse_iova_umem {* struct vduse_iova_info - information of one IOVA region * @start: start of the IOVA region * @last: last of the IOVA region -* @capability: capability of the IOVA regsion +* @capability: capability of the IOVA region * @reserved: for future use, needs to be initialized to zero * * Structure used by VDUSE_IOTLB_GET_INFO ioctl to get information of
kernel/linux/uapi/linux/vfio.h +39 -1
@@ -14,6 +14,7 @@#include <linux/types.h> #include <linux/ioctl.h> +#include <linux/stddef.h> #define VFIO_API_VERSION 0
@@ -905,10 +906,12 @@ struct vfio_device_feature {* VFIO_DEVICE_BIND_IOMMUFD - _IOR(VFIO_TYPE, VFIO_BASE + 18, * struct vfio_device_bind_iommufd) * @argsz: User filled size of this data. -* @flags: Must be 0. +* @flags: Must be 0 or a bit flags of VFIO_DEVICE_BIND_* * @iommufd: iommufd to bind. * @out_devid: The device id generated by this bind. devid is a handle for * this device/iommufd bond and can be used in IOMMUFD commands. +* @token_uuid_ptr: Valid if VFIO_DEVICE_BIND_FLAG_TOKEN. Points to a 16 byte +* UUID in the same format as VFIO_DEVICE_FEATURE_PCI_VF_TOKEN. * * Bind a vfio_device to the specified iommufd. *
@@ -917,13 +920,21 @@ struct vfio_device_feature {* * Unbind is automatically conducted when device fd is closed. * +* A token is sometimes required to open the device, unless this is known to be +* needed VFIO_DEVICE_BIND_FLAG_TOKEN should not be set and token_uuid_ptr is +* ignored. The only case today is a PF/VF relationship where the VF bind must +* be provided the same token as VFIO_DEVICE_FEATURE_PCI_VF_TOKEN provided to +* the PF. +* * Return: 0 on success, -errno on failure. */ struct vfio_device_bind_iommufd {__u32 argsz;__u32 flags; +#define VFIO_DEVICE_BIND_FLAG_TOKEN (1 << 0)__s32 iommufd;__u32 out_devid; +__aligned_u64 token_uuid_ptr; };#define VFIO_DEVICE_BIND_IOMMUFD _IO(VFIO_TYPE, VFIO_BASE + 18)
@@ -1468,6 +1479,33 @@ struct vfio_device_feature_bus_master { };#define VFIO_DEVICE_FEATURE_BUS_MASTER 10 +/** +* Upon VFIO_DEVICE_FEATURE_GET create a dma_buf fd for the +* regions selected. +* +* open_flags are the typical flags passed to open(2), eg O_RDWR, O_CLOEXEC, +* etc. offset/length specify a slice of the region to create the dmabuf from. +* nr_ranges is the total number of (P2P DMA) ranges that comprise the dmabuf. +* +* flags should be 0. +* +* Return: The fd number on success, -1 and errno is set on failure. +*/ +#define VFIO_DEVICE_FEATURE_DMA_BUF 11 + +struct vfio_region_dma_range { +__u64 offset; +__u64 length; +}; + +struct vfio_device_feature_dma_buf { +__u32 region_index; +__u32 open_flags; +__u32 flags; +__u32 nr_ranges; + struct vfio_region_dma_range dma_ranges[] __counted_by(nr_ranges); +}; +/* -------- API for Type1 VFIO IOMMU -------- */ /**
kernel/linux/uapi/version +1 -1
@@ -1 +1 @@ -v6.16 +v6.19
Signature · 1 line
2.55.0
Re: [PATCH 2/2] uapi: update headers to v6.19
kernel/linux/uapi/linux/vfio.h line 18
Quoted 10 lines · On Wed, 30 Sep 2026 11:58:00 +0200 Maxime Coquelin…
kernel/linux/uapi/linux/vfio.h +1
-0@@ -14,6 +14,7 @@#include <linux/types.h> #include <linux/ioctl.h> +#include <linux/stddef.h>
Just add sanitized stddef.h into kernel/linux/uapi/linux
Re: [PATCH 2/2] uapi: update headers to v6.19
Quoted 10 lines · Stephen Hemminger
Review
Quoted 1 line · On Wed, 30 Sep 2026 11:58:00 +0200 Maxime Coquelin…
(quoted diff) +0
-0
b/kernel/linux/uapi/linux/vfio.hQuoted 5 lines
index
79bf8c0cc5..720edfee7a100644kernel/linux/uapi/linux/vfio.h +0
-0@@ -14,6 +14,7 @@
Quoted 8 lines
kernel/linux/uapi/linux/vfio.h line 18
Quoted 4 lines
kernel/linux/uapi/linux/vfio.h +1
-0#include <linux/types.h> #include <linux/ioctl.h> +#include <linux/stddef.h> Just add sanitized
stddef.hintokernel/linux/uapi/linux
See my reply on patch 1 where I explain why it does not work.
PATCH v2 1/1 uapi: update headers to v6.19
In reply to Maxime CoquelinFrom: Maxime Coquelin <[email protected]>
This patch updates imported UAPI headers to v6.19, in order to exercise the new compatibility define for __counted_by.
Since __counted_by is introduced by linux/stddef.h we need to import it, and the headers, included by already imported headers, leading to its inclusion.
One complication is that linux/types.h contains a guard that must be sanitized using the same method as the Linux kernel.
For this, add a dependency on the unifdef tool.
We also need to fix net/nbl which does not include the VFIO uapi header first.
---
Changes since v1:
- dropped wrapper on __counted_by,
- updated import process and added use of unidef,
- fixed net/nbl driver,
- imported needed uapi headers,
--- devtools/linux-uapi.sh | 6 ++ doc/guides/contributing/linux_uapi.rst | 2 + drivers/net/nbl/nbl_common/nbl_userdev.c | 3 +- kernel/linux/uapi/linux/posix_types.h | 38 ++++++++++++ kernel/linux/uapi/linux/stddef.h | 74 ++++++++++++++++++++++++ kernel/linux/uapi/linux/types.h | 58 +++++++++++++++++++ kernel/linux/uapi/linux/vduse.h | 4 +- kernel/linux/uapi/linux/vfio.h | 42 +++++++++++++- kernel/linux/uapi/version | 2 +- 9 files changed, 223 insertions(+), 6 deletions(-) create mode 100644 kernel/linux/uapi/linux/posix_types.h create mode 100644 kernel/linux/uapi/linux/stddef.h create mode 100644 kernel/linux/uapi/linux/types.h
devtools/linux-uapi.sh +6 -0
@@ -13,6 +13,9 @@ file="" check_headers=false quiet=false +# Require unifdef +unifdef -h >/dev/null 2>&1 || { echo "This script requires unifdef."; exit 1; } + print_usage() { echo "Usage: $(basename $0) [-h] [-i FILE] [-u VERSION] [-c] [-q]"
@@ -85,6 +88,9 @@ fixup_includes() sed -i 's|#\(define\)[[:space:]]*_UAPI|#\1 |' $path sed -i 's|#\(endif[[:space:]]*/[*]\)[[:space:]]*_UAPI|#\1 |' $path + unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ -o ${path}.tmp $path || [ $? -lt 2 ] + mv -f ${path}.tmp $path + # Prepend include path with "uapi/" if the header is imported for include in $(sed -ne 's/^#include <\(.*\)>$/\1/p' $path); do if [ -f "$base_path$include" ]; then
doc/guides/contributing/linux_uapi.rst +2 -0
@@ -27,6 +27,8 @@ Importing or updating an uAPI header file To ensure that imported uAPI headers are unmodified and sourced from an official Linux kernel release, a helper script is provided and must be used. +This script requires the ``unifdef`` tool. + Below is an example to import ``linux/vduse.h`` file from Linux ``v6.10``: .. code-block:: console
drivers/net/nbl/nbl_common/nbl_userdev.c +2 -1
@@ -2,8 +2,9 @@* Copyright 2025 Nebulamatrix Technology Co., Ltd. */ -#include "nbl_userdev.h" #include <uapi/linux/vfio.h> + +#include "nbl_userdev.h" #include <rte_vfio.h> #define NBL_USERDEV_EVENT_CLB_NAME "nbl_userspace_mem_event_clb"
kernel/linux/uapi/linux/posix_types.h new file +38 -0
@@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _LINUX_POSIX_TYPES_H +#define _LINUX_POSIX_TYPES_H + +#include <uapi/linux/stddef.h> + +/* +* This allows for 1024 file descriptors: if NR_OPEN is ever grown +* beyond that you'll have to change this too. But 1024 fd's seem to be +* enough even for such "real" unices like OSF/1, so hopefully this is +* one limit that doesn't have to be changed [again]. +* +* Note that POSIX wants the FD_CLEAR(fd,fdsetp) defines to be in +* <sys/time.h> (and thus <linux/time.h>) - but this is a more logical +* place for them. Solved by having dummy defines in <sys/time.h>. +*/ + +/* +* This macro may have been defined in <gnu/types.h>. But we always +* use the one here. +*/ +#undef __FD_SETSIZE +#define __FD_SETSIZE 1024 + +typedef struct { +unsigned long fds_bits[__FD_SETSIZE / (8 *sizeof (long ))]; +}__kernel_fd_set ; + +/* Type of a signal handler. */ +typedef void (*__kernel_sighandler_t )(int ); + +/* Type of a SYSV IPC key. */ +typedef int __kernel_key_t ; +typedef int __kernel_mqd_t ; + +#include <asm/posix_types.h> + +#endif /* _LINUX_POSIX_TYPES_H */
kernel/linux/uapi/linux/stddef.h new file +74 -0
74 lines not on this page · raw message
kernel/linux/uapi/linux/types.h new file +58 -0
58 lines not on this page · raw message
kernel/linux/uapi/linux/vduse.h +2 -2
@@ -2,7 +2,7 @@#ifndef _VDUSE_H_#define _VDUSE_H_ -#include <linux/types.h> +#include <uapi/linux/types.h> #define VDUSE_BASE 0x81
@@ -237,7 +237,7 @@ struct vduse_iova_umem {* struct vduse_iova_info - information of one IOVA region * @start: start of the IOVA region * @last: last of the IOVA region -* @capability: capability of the IOVA regsion +* @capability: capability of the IOVA region * @reserved: for future use, needs to be initialized to zero * * Structure used by VDUSE_IOTLB_GET_INFO ioctl to get information of
kernel/linux/uapi/linux/vfio.h +40 -2
77 lines not on this page · raw message
kernel/linux/uapi/version +1 -1
@@ -1 +1 @@ -v6.16 +v6.19
Signature · 1 line
2.54.0
Re: [PATCH v2] uapi: update headers to v6.19
Quoted 25 lines · David Marchand
From: Maxime Coquelin <[email protected]>
This patch updates imported UAPI headers to v6.19, in order to exercise the new compatibility define for
__counted_by.Since
__counted_byis introduced bylinux/stddef.hwe need to import it, and the headers, included by already imported headers, leading to its inclusion.One complication is that
linux/types.hcontains a guard that must be sanitized using the same method as the Linux kernel.
For this, add a dependency on the unifdef tool.We also need to fix net/nbl which does not include the VFIO uapi header first.
Signed-off-by Maxime Coquelin <[email protected]>Signed-off-by David Marchand <[email protected]>---
Changes since v1:
- dropped wrapper on__counted_by,
- updated import process and added use of unidef,
- fixed net/nbl driver,
- imported needed uapi headers,
Quoted 17 lines
--- devtools/linux-uapi.sh | 6 ++ doc/guides/contributing/linux_uapi.rst | 2 + drivers/net/nbl/nbl_common/nbl_userdev.c | 3 +- kernel/linux/uapi/linux/posix_types.h | 38 ++++++++++++ kernel/linux/uapi/linux/stddef.h | 74 ++++++++++++++++++++++++ kernel/linux/uapi/linux/types.h | 58 +++++++++++++++++++ kernel/linux/uapi/linux/vduse.h | 4 +- kernel/linux/uapi/linux/vfio.h | 42 +++++++++++++- kernel/linux/uapi/version | 2 +- 9 files changed, 223 insertions(+), 6 deletions(-) create mode 100644 kernel/linux/uapi/linux/posix_types.h create mode 100644 kernel/linux/uapi/linux/stddef.h create mode 100644 kernel/linux/uapi/linux/types.h
Thanks!
Maxime
Re: [PATCH v2] uapi: update headers to v6.19
In reply to David MarchandQuoted 13 lines · On Thu, 1 Oct 2026 11:05:58 +0200 David Marchand <[email protected]>…
From: Maxime Coquelin <[email protected]>
This patch updates imported UAPI headers to v6.19, in order to exercise the new compatibility define for
__counted_by.Since
__counted_byis introduced bylinux/stddef.hwe need to import it, and the headers, included by already imported headers, leading to its inclusion.One complication is that
linux/types.hcontains a guard that must be sanitized using the same method as the Linux kernel.
For this, add a dependency on the unifdef tool.
Quoted 6 lines
We also need to fix net/nbl which does not include the VFIO uapi header first.
Signed-off-by Maxime Coquelin <[email protected]>Signed-off-by David Marchand <[email protected]>---
Can take it through next-net but makes more sense to go through next-virtio
Re: [PATCH v2] uapi: update headers to v6.19
In reply to David Marchand01/10/2026 11:05, David Marchand:
devtools/linux-uapi.sh file="" · line 17
Quoted 8 lines
devtools/linux-uapi.sh +2
-0@@ -13,6 +13,9 @@ file="" check_headers=false quiet=false +# Require unifdef +unifdef -h >/dev/null 2>&1 || { echo "This script requires unifdef."; exit 1; }
Do you need to send the message to stderr?
drivers/net/nbl/nbl_common/nbl_userdev.c line 8
Quoted 11 lines
drivers/net/nbl/nbl_common/nbl_userdev.c +2
-1@@ -2,8 +2,9 @@* Copyright 2025 Nebulamatrix Technology Co., Ltd. */ -#include "nbl_userdev.h" #include <uapi/linux/vfio.h> + +#include "nbl_userdev.h" #include <rte_vfio.h>
This is tricky.
Is it documented that uAPI headers should be included first?
Re: [PATCH v2] uapi: update headers to v6.19
Quoted 8 lines · Thomas Monjalon
01/10/2026 11:05, David Marchand:
Quoted 6 lines
devtools/linux-uapi.sh +0
-0@@ -13,6 +13,9 @@ file="" check_headers=false quiet=false
Quoted 4 lines
devtools/linux-uapi.sh file="" · line 17
Quoted 2 lines
devtools/linux-uapi.sh +2
-0+# Require unifdef +unifdef -h >/dev/null 2>&1 || { echo "This script requires unifdef."; exit 1; }Do you need to send the message to stderr?
Yes.
Quoted 6 lines
Quoted 6 lines
drivers/net/nbl/nbl_common/nbl_userdev.c +0
-0@@ -2,8 +2,9 @@* Copyright 2025 Nebulamatrix Technology Co., Ltd. */
Quoted 8 lines
drivers/net/nbl/nbl_common/nbl_userdev.c line 8
Quoted 5 lines
drivers/net/nbl/nbl_common/nbl_userdev.c +2
-1-#include "nbl_userdev.h" #include <uapi/linux/vfio.h> + +#include "nbl_userdev.h" #include <rte_vfio.h> This is tricky.
Is it documented that uAPI headers should be included first?
https://doc.dpdk.org/guides/contributing/linux_uapi.html#header-inclusion-into-library-or-driver
"""
This inclusion must be done before any header external to DPDK is included, to prevent inclusion of the system uAPI header in any of those external headers.
"""
Signature · 1 line
David Marchand
Re: [PATCH v2] uapi: update headers to v6.19
In reply to David MarchandQuoted 14 lines · David Marchand
From: Maxime Coquelin <[email protected]>
This patch updates imported UAPI headers to v6.19, in order to exercise the new compatibility define for
__counted_by.Since
__counted_byis introduced bylinux/stddef.hwe need to import it, and the headers, included by already imported headers, leading to its inclusion.One complication is that
linux/types.hcontains a guard that must be sanitized using the same method as the Linux kernel.
For this, add a dependency on the unifdef tool.
Quoted 5 lines
We also need to fix net/nbl which does not include the VFIO uapi header first.
Signed-off-by Maxime Coquelin <[email protected]>Signed-off-by David Marchand <[email protected]>
Moved error logging to stderr.
Applied, thanks.
Signature · 1 line
David Marchand