netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2-next 0/2] Add uapi header import script
@ 2025-09-09 13:21 Kory Maincent
  2025-09-09 13:21 ` [PATCH iproute2-next 1/2] scripts: " Kory Maincent
  2025-09-09 13:21 ` [PATCH iproute2-next 2/2] Update kernel headers Kory Maincent
  0 siblings, 2 replies; 11+ messages in thread
From: Kory Maincent @ 2025-09-09 13:21 UTC (permalink / raw)
  To: David Ahern; +Cc: netdev, Thomas Petazzoni, Kory Maincent

Add a script to automate importing Linux UAPI headers from kernel source.
The script handles dependency resolution and creates a commit with proper
attribution, similar to the ethtool project approach.

Run the script and import the current state of Linux UAPI header from
net-next.

Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
Kory Maincent (2):
      scripts: Add uapi header import script
      Update kernel headers

 include/uapi/linux/devlink.h |  2 ++
 include/uapi/linux/if_link.h |  1 +
 include/uapi/linux/stddef.h  |  1 -
 scripts/iproute2-import-uapi | 67 ++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 70 insertions(+), 1 deletion(-)
---
base-commit: 68ba2bc6e2d060526496bc79591b09fcbc851a7f
change-id: 20250909-feature_uapi_import-8bdbade4fb93

Best regards,
-- 
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH iproute2-next 1/2] scripts: Add uapi header import script
  2025-09-09 13:21 [PATCH iproute2-next 0/2] Add uapi header import script Kory Maincent
@ 2025-09-09 13:21 ` Kory Maincent
  2025-09-11 20:57   ` David Ahern
                     ` (3 more replies)
  2025-09-09 13:21 ` [PATCH iproute2-next 2/2] Update kernel headers Kory Maincent
  1 sibling, 4 replies; 11+ messages in thread
From: Kory Maincent @ 2025-09-09 13:21 UTC (permalink / raw)
  To: David Ahern; +Cc: netdev, Thomas Petazzoni, Kory Maincent

Add a script to automate importing Linux UAPI headers from kernel source.
The script handles dependency resolution and creates a commit with proper
attribution, similar to the ethtool project approach.

Usage:
    $ LINUX_GIT="$LINUX_PATH" iproute2-import-uapi [commit]

Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
 scripts/iproute2-import-uapi | 67 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)

diff --git a/scripts/iproute2-import-uapi b/scripts/iproute2-import-uapi
new file mode 100755
index 00000000..505ab25a
--- /dev/null
+++ b/scripts/iproute2-import-uapi
@@ -0,0 +1,67 @@
+#!/bin/bash -e
+#
+# iproute2-import-uapi [commit]
+#
+# Imports sanitized copies of kernel uapi headers from <commit> (can be
+# a commit id, a tag or a branch name). If the argument is omitted,
+# commit currently checked out in the kernel repository is used.
+
+sn="${0##*/}"
+export ARCH="x86_64"
+mkopt="-j$(nproc)" || mkopt=''
+
+if [ ! -d "$LINUX_GIT" ]; then
+    echo "${sn}: please set LINUX_GIT to the location of kernel git" >&2
+    exit 1
+fi
+
+pushd "$LINUX_GIT"
+if [ -n "$1" ]; then
+    git checkout "$1"
+fi
+desc=$(git describe --exact-match 2>/dev/null \
+       || git show -s --abbrev=12 --pretty='%h: ("%s")')
+kobj=$(mktemp -d)
+make $mkopt O="$kobj" allmodconfig
+make $mkopt O="$kobj" prepare
+make $mkopt O="$kobj" INSTALL_HDR_PATH="${kobj}/hdr" headers_install
+popd
+
+pushd include/uapi
+find . -type f -name '*.h' -exec cp -v "${kobj}/hdr/include/{}" {} \;
+
+go_on=true
+while $go_on; do
+    go_on=false
+    while read f; do
+        if [ "${f#asm/}" != "$f" ]; then
+            # skip architecture dependent asm/ headers
+            continue
+        fi
+        if [ -f "$f" ]; then
+            # already present
+            continue
+        fi
+	if [ ! -f "${kobj}/hdr/include/${f}" ]; then
+            # not a kernel header
+            continue
+        fi
+        echo "+ add $f"
+        go_on=true
+        mkdir -p "${f%/*}"
+        cp "${kobj}/hdr/include/${f}" "${f}"
+    done < <(
+        find . -type f -name '*.[ch]' -exec sed -nre '\_^[[:blank:]]*#include[[:blank:]]<.+>_ { s_^[[:blank:]]*#include[[:blank:]]<([^>]*)>.*$_\1_ ; p }' {} \; \
+            | LC_ALL=C sort -u
+    )
+done
+popd
+rm -rf "$kobj"
+
+git add include/uapi
+git commit -s -F - <<EOT
+Update kernel headers
+
+Update kernel headers to commit:
+	${desc}
+EOT

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH iproute2-next 2/2] Update kernel headers
  2025-09-09 13:21 [PATCH iproute2-next 0/2] Add uapi header import script Kory Maincent
  2025-09-09 13:21 ` [PATCH iproute2-next 1/2] scripts: " Kory Maincent
@ 2025-09-09 13:21 ` Kory Maincent
  1 sibling, 0 replies; 11+ messages in thread
From: Kory Maincent @ 2025-09-09 13:21 UTC (permalink / raw)
  To: David Ahern; +Cc: netdev, Thomas Petazzoni, Kory Maincent

Update kernel headers to commit:
	aeb8d48ea92e: ("selftests: net: add test for ipv6 fragmentation")

Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
 include/uapi/linux/devlink.h | 2 ++
 include/uapi/linux/if_link.h | 1 +
 include/uapi/linux/stddef.h  | 1 -
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h
index a89df2a7..bcd5fde1 100644
--- a/include/uapi/linux/devlink.h
+++ b/include/uapi/linux/devlink.h
@@ -636,6 +636,8 @@ enum devlink_attr {
 
 	DEVLINK_ATTR_RATE_TC_BWS,		/* nested */
 
+	DEVLINK_ATTR_HEALTH_REPORTER_BURST_PERIOD,	/* u64 */
+
 	/* Add new attributes above here, update the spec in
 	 * Documentation/netlink/specs/devlink.yaml and re-generate
 	 * net/devlink/netlink_gen.c.
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index b450757c..8c460dc3 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -1562,6 +1562,7 @@ enum {
 	IFLA_BOND_SLAVE_AD_ACTOR_OPER_PORT_STATE,
 	IFLA_BOND_SLAVE_AD_PARTNER_OPER_PORT_STATE,
 	IFLA_BOND_SLAVE_PRIO,
+	IFLA_BOND_SLAVE_ACTOR_PORT_PRIO,
 	__IFLA_BOND_SLAVE_MAX,
 };
 
diff --git a/include/uapi/linux/stddef.h b/include/uapi/linux/stddef.h
index e1fcfcf3..48ee4438 100644
--- a/include/uapi/linux/stddef.h
+++ b/include/uapi/linux/stddef.h
@@ -3,7 +3,6 @@
 #define _LINUX_STDDEF_H
 
 
-
 #ifndef __always_inline
 #define __always_inline __inline__
 #endif

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH iproute2-next 1/2] scripts: Add uapi header import script
  2025-09-09 13:21 ` [PATCH iproute2-next 1/2] scripts: " Kory Maincent
@ 2025-09-11 20:57   ` David Ahern
  2025-09-11 21:59   ` Stephen Hemminger
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: David Ahern @ 2025-09-11 20:57 UTC (permalink / raw)
  To: Kory Maincent; +Cc: netdev, Thomas Petazzoni, Stephen Hemminger

On 9/9/25 7:21 AM, Kory Maincent wrote:
> Add a script to automate importing Linux UAPI headers from kernel source.
> The script handles dependency resolution and creates a commit with proper
> attribution, similar to the ethtool project approach.
> 
> Usage:
>     $ LINUX_GIT="$LINUX_PATH" iproute2-import-uapi [commit]
> 
> Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
> ---
>  scripts/iproute2-import-uapi | 67 ++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 67 insertions(+)
> 

Stephen and I have scripts for this, but this one is fairly easy to use,
so applied.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH iproute2-next 1/2] scripts: Add uapi header import script
  2025-09-09 13:21 ` [PATCH iproute2-next 1/2] scripts: " Kory Maincent
  2025-09-11 20:57   ` David Ahern
@ 2025-09-11 21:59   ` Stephen Hemminger
  2025-09-16 14:40   ` Stephen Hemminger
  2025-09-16 14:41   ` Stephen Hemminger
  3 siblings, 0 replies; 11+ messages in thread
From: Stephen Hemminger @ 2025-09-11 21:59 UTC (permalink / raw)
  To: Kory Maincent; +Cc: David Ahern, netdev, Thomas Petazzoni

On Tue, 09 Sep 2025 15:21:42 +0200
Kory Maincent <kory.maincent@bootlin.com> wrote:

> Add a script to automate importing Linux UAPI headers from kernel source.
> The script handles dependency resolution and creates a commit with proper
> attribution, similar to the ethtool project approach.
> 
> Usage:
>     $ LINUX_GIT="$LINUX_PATH" iproute2-import-uapi [commit]
> 
> Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>

I will continue to use my script which works off of headers processed
by "make headers_install"




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH iproute2-next 1/2] scripts: Add uapi header import script
  2025-09-09 13:21 ` [PATCH iproute2-next 1/2] scripts: " Kory Maincent
  2025-09-11 20:57   ` David Ahern
  2025-09-11 21:59   ` Stephen Hemminger
@ 2025-09-16 14:40   ` Stephen Hemminger
  2025-09-16 15:20     ` David Ahern
  2025-09-16 14:41   ` Stephen Hemminger
  3 siblings, 1 reply; 11+ messages in thread
From: Stephen Hemminger @ 2025-09-16 14:40 UTC (permalink / raw)
  To: Kory Maincent; +Cc: David Ahern, netdev, Thomas Petazzoni

On Tue, 09 Sep 2025 15:21:42 +0200
Kory Maincent <kory.maincent@bootlin.com> wrote:

> Add a script to automate importing Linux UAPI headers from kernel source.
> The script handles dependency resolution and creates a commit with proper
> attribution, similar to the ethtool project approach.
> 
> Usage:
>     $ LINUX_GIT="$LINUX_PATH" iproute2-import-uapi [commit]
> 
> Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>

This script doesn't handle the fact that kernel headers for iproute
exist in multiple locations because rdma and vduse.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH iproute2-next 1/2] scripts: Add uapi header import script
  2025-09-09 13:21 ` [PATCH iproute2-next 1/2] scripts: " Kory Maincent
                     ` (2 preceding siblings ...)
  2025-09-16 14:40   ` Stephen Hemminger
@ 2025-09-16 14:41   ` Stephen Hemminger
  2025-09-16 16:01     ` Kory Maincent
  3 siblings, 1 reply; 11+ messages in thread
From: Stephen Hemminger @ 2025-09-16 14:41 UTC (permalink / raw)
  To: Kory Maincent; +Cc: David Ahern, netdev, Thomas Petazzoni

On Tue, 09 Sep 2025 15:21:42 +0200
Kory Maincent <kory.maincent@bootlin.com> wrote:

> Add a script to automate importing Linux UAPI headers from kernel source.
> The script handles dependency resolution and creates a commit with proper
> attribution, similar to the ethtool project approach.
> 
> Usage:
>     $ LINUX_GIT="$LINUX_PATH" iproute2-import-uapi [commit]
> 
> Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
> ---

Script I use is much simpler.

#! /bin/bash
# script to copy sanitized kernel headers

if [ $# -ne 1 ]; then
   echo "Usage: $0 kernel-directory"
   exit 1
fi

SRC=$1
if [ ! -r $SRC/usr/include/linux/rtnetlink.h ]; then
   echo "$SRC is missing headers"
   exit 1
fi

if [ ! -r include/uapi/linux/rtnetlink.h ]; then
    echo "$PWD is not iproute2 source"
    exit 1
fi

for subdir in . rdma vdpa
do	   
    DST=$subdir/include/uapi
    echo Checking $DST

    (cd $DST; find . -type f) | \
	while read f
	do
	    from=$SRC/usr/include/$f
	    to=$DST/$f
	    if ! cmp -s $from $to
	    then
		echo Updating $f
		cp $from $to
	    fi
	done
done

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH iproute2-next 1/2] scripts: Add uapi header import script
  2025-09-16 14:40   ` Stephen Hemminger
@ 2025-09-16 15:20     ` David Ahern
  0 siblings, 0 replies; 11+ messages in thread
From: David Ahern @ 2025-09-16 15:20 UTC (permalink / raw)
  To: Stephen Hemminger, Kory Maincent; +Cc: netdev, Thomas Petazzoni

On 9/16/25 8:40 AM, Stephen Hemminger wrote:
> On Tue, 09 Sep 2025 15:21:42 +0200
> Kory Maincent <kory.maincent@bootlin.com> wrote:
> 
>> Add a script to automate importing Linux UAPI headers from kernel source.
>> The script handles dependency resolution and creates a commit with proper
>> attribution, similar to the ethtool project approach.
>>
>> Usage:
>>     $ LINUX_GIT="$LINUX_PATH" iproute2-import-uapi [commit]
>>
>> Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
> 
> This script doesn't handle the fact that kernel headers for iproute
> exist in multiple locations because rdma and vduse.

rdma and vdpa are not synced from net-next.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH iproute2-next 1/2] scripts: Add uapi header import script
  2025-09-16 14:41   ` Stephen Hemminger
@ 2025-09-16 16:01     ` Kory Maincent
  2025-09-16 16:05       ` David Ahern
  0 siblings, 1 reply; 11+ messages in thread
From: Kory Maincent @ 2025-09-16 16:01 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David Ahern, netdev, Thomas Petazzoni

On Tue, 16 Sep 2025 07:41:55 -0700
Stephen Hemminger <stephen@networkplumber.org> wrote:

> On Tue, 09 Sep 2025 15:21:42 +0200
> Kory Maincent <kory.maincent@bootlin.com> wrote:
> 
> > Add a script to automate importing Linux UAPI headers from kernel source.
> > The script handles dependency resolution and creates a commit with proper
> > attribution, similar to the ethtool project approach.
> > 
> > Usage:
> >     $ LINUX_GIT="$LINUX_PATH" iproute2-import-uapi [commit]
> > 
> > Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
> > ---  
> 
> Script I use is much simpler.

The aim of my patch was to add a standard way of updating the uAPI header.
Indeed I supposed you maintainers, already have a script for that but for
developers that add support for new features they don't have such scripts.
People even may do it manually, even if I hope that's not the case.
We can see that the git commit messages on include/uapi/ are not
really consistent. 

IMHO using the same script as ethtool was natural.
The final decision is your call but I think we should have a standard script
whatever it is.

Regards,
-- 
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH iproute2-next 1/2] scripts: Add uapi header import script
  2025-09-16 16:01     ` Kory Maincent
@ 2025-09-16 16:05       ` David Ahern
  2025-09-16 16:19         ` Kory Maincent
  0 siblings, 1 reply; 11+ messages in thread
From: David Ahern @ 2025-09-16 16:05 UTC (permalink / raw)
  To: Kory Maincent, Stephen Hemminger; +Cc: netdev, Thomas Petazzoni

On 9/16/25 10:01 AM, Kory Maincent wrote:
> On Tue, 16 Sep 2025 07:41:55 -0700
> Stephen Hemminger <stephen@networkplumber.org> wrote:
> 
>> On Tue, 09 Sep 2025 15:21:42 +0200
>> Kory Maincent <kory.maincent@bootlin.com> wrote:
>>
>>> Add a script to automate importing Linux UAPI headers from kernel source.
>>> The script handles dependency resolution and creates a commit with proper
>>> attribution, similar to the ethtool project approach.
>>>
>>> Usage:
>>>     $ LINUX_GIT="$LINUX_PATH" iproute2-import-uapi [commit]
>>>
>>> Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
>>> ---  
>>
>> Script I use is much simpler.
> 
> The aim of my patch was to add a standard way of updating the uAPI header.
> Indeed I supposed you maintainers, already have a script for that but for
> developers that add support for new features they don't have such scripts.
> People even may do it manually, even if I hope that's not the case.
> We can see that the git commit messages on include/uapi/ are not
> really consistent. 
> 
> IMHO using the same script as ethtool was natural.
> The final decision is your call but I think we should have a standard script
> whatever it is.
> 
> Regards,

There are separate needs.

I sync include/uapi for iproute2-next based on net-next. rdma and vdpa
have separate -next trees which is why they have their own include/uapi
directories. This script makes this part much easier for me hence why I
merged it.

Stephen will ensure all uapi headers match the kernel release meaning
Linus' tree.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH iproute2-next 1/2] scripts: Add uapi header import script
  2025-09-16 16:05       ` David Ahern
@ 2025-09-16 16:19         ` Kory Maincent
  0 siblings, 0 replies; 11+ messages in thread
From: Kory Maincent @ 2025-09-16 16:19 UTC (permalink / raw)
  To: David Ahern; +Cc: Stephen Hemminger, netdev, Thomas Petazzoni

On Tue, 16 Sep 2025 10:05:16 -0600
David Ahern <dsahern@gmail.com> wrote:

> On 9/16/25 10:01 AM, Kory Maincent wrote:
> > On Tue, 16 Sep 2025 07:41:55 -0700
> > Stephen Hemminger <stephen@networkplumber.org> wrote:
> >   
> >> On Tue, 09 Sep 2025 15:21:42 +0200
> >> Kory Maincent <kory.maincent@bootlin.com> wrote:
> >>  
>  [...]  
> >>
> >> Script I use is much simpler.  
> > 
> > The aim of my patch was to add a standard way of updating the uAPI header.
> > Indeed I supposed you maintainers, already have a script for that but for
> > developers that add support for new features they don't have such scripts.
> > People even may do it manually, even if I hope that's not the case.
> > We can see that the git commit messages on include/uapi/ are not
> > really consistent. 
> > 
> > IMHO using the same script as ethtool was natural.
> > The final decision is your call but I think we should have a standard script
> > whatever it is.
> > 
> > Regards,  
> 
> There are separate needs.
> 
> I sync include/uapi for iproute2-next based on net-next. rdma and vdpa
> have separate -next trees which is why they have their own include/uapi
> directories. This script makes this part much easier for me hence why I
> merged it.
> 
> Stephen will ensure all uapi headers match the kernel release meaning
> Linus' tree.

Oh, ok. Thanks for the clarification.

Regards,
-- 
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-09-16 16:20 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-09 13:21 [PATCH iproute2-next 0/2] Add uapi header import script Kory Maincent
2025-09-09 13:21 ` [PATCH iproute2-next 1/2] scripts: " Kory Maincent
2025-09-11 20:57   ` David Ahern
2025-09-11 21:59   ` Stephen Hemminger
2025-09-16 14:40   ` Stephen Hemminger
2025-09-16 15:20     ` David Ahern
2025-09-16 14:41   ` Stephen Hemminger
2025-09-16 16:01     ` Kory Maincent
2025-09-16 16:05       ` David Ahern
2025-09-16 16:19         ` Kory Maincent
2025-09-09 13:21 ` [PATCH iproute2-next 2/2] Update kernel headers Kory Maincent

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).