* [PATCH net-next 0/2] tools/ynl: add missing uapi header deps in Makefile.deps
@ 2026-05-08 20:41 Stanislav Fomichev
2026-05-08 20:41 ` [PATCH net-next 1/2] " Stanislav Fomichev
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Stanislav Fomichev @ 2026-05-08 20:41 UTC (permalink / raw)
To: netdev
Cc: davem, edumazet, kuba, pabeni, donald.hunter, horms, sdf,
linux-kernel
When syncing ynl-cpp to net-next v7.0-rc3, typelimits.h (for ethtool) and
dev_energymodel.h had to be manually hacked into the downstream
Makefile.deps:
https://github.com/linux-netdev/ynl-cpp/pull/16/changes/94bd9656423cab7dfce73dc824f75b59ef25668d
Fix the upstream Makefile.deps so that downstream copies stay in sync.
Stanislav Fomichev (2):
tools/ynl: add missing uapi header deps in Makefile.deps
tools/ynl: add check-deps target to verify Makefile.deps completeness
tools/net/ynl/Makefile.deps | 39 +++++++++++++++++++++++++++++++-
tools/net/ynl/generated/Makefile | 6 ++++-
2 files changed, 43 insertions(+), 2 deletions(-)
--
2.53.0-Meta
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net-next 1/2] tools/ynl: add missing uapi header deps in Makefile.deps
2026-05-08 20:41 [PATCH net-next 0/2] tools/ynl: add missing uapi header deps in Makefile.deps Stanislav Fomichev
@ 2026-05-08 20:41 ` Stanislav Fomichev
2026-05-08 20:41 ` [PATCH net-next 2/2] tools/ynl: add check-deps target to verify Makefile.deps completeness Stanislav Fomichev
2026-05-10 15:40 ` [PATCH net-next 0/2] tools/ynl: add missing uapi header deps in Makefile.deps patchwork-bot+netdevbpf
2 siblings, 0 replies; 5+ messages in thread
From: Stanislav Fomichev @ 2026-05-08 20:41 UTC (permalink / raw)
To: netdev
Cc: davem, edumazet, kuba, pabeni, donald.hunter, horms, sdf,
linux-kernel
ethtool.h includes linux/typelimits.h which is a relatively new header
not yet shipped in most distro kernel-header packages. Without the
explicit entry, the build silently falls through to -idirafter.
dev_energymodel.h is a new YNL family whose uapi header is not in
system paths at all and was missing a CFLAGS entry entirely.
Signed-off-by: Stanislav Fomichev <sdf@fomichev.me>
---
tools/net/ynl/Makefile.deps | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/net/ynl/Makefile.deps b/tools/net/ynl/Makefile.deps
index 08205f9fc525..cc53b2f21c44 100644
--- a/tools/net/ynl/Makefile.deps
+++ b/tools/net/ynl/Makefile.deps
@@ -15,9 +15,11 @@ UAPI_PATH:=../../../../include/uapi/
get_hdr_inc=-D$(1) -include $(UAPI_PATH)/linux/$(2)
get_hdr_inc2=-D$(1) -D$(2) -include $(UAPI_PATH)/linux/$(3)
+CFLAGS_dev-energymodel:=$(call get_hdr_inc,_LINUX_DEV_ENERGYMODEL_H,dev_energymodel.h)
CFLAGS_devlink:=$(call get_hdr_inc,_LINUX_DEVLINK_H_,devlink.h)
CFLAGS_dpll:=$(call get_hdr_inc,_LINUX_DPLL_H,dpll.h)
-CFLAGS_ethtool:=$(call get_hdr_inc,_LINUX_ETHTOOL_H,ethtool.h) \
+CFLAGS_ethtool:=$(call get_hdr_inc,_LINUX_TYPELIMITS_H,typelimits.h) \
+ $(call get_hdr_inc,_LINUX_ETHTOOL_H,ethtool.h) \
$(call get_hdr_inc,_LINUX_ETHTOOL_NETLINK_H_,ethtool_netlink.h) \
$(call get_hdr_inc,_LINUX_ETHTOOL_NETLINK_GENERATED_H,ethtool_netlink_generated.h)
CFLAGS_handshake:=$(call get_hdr_inc,_LINUX_HANDSHAKE_H,handshake.h)
--
2.53.0-Meta
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH net-next 2/2] tools/ynl: add check-deps target to verify Makefile.deps completeness
2026-05-08 20:41 [PATCH net-next 0/2] tools/ynl: add missing uapi header deps in Makefile.deps Stanislav Fomichev
2026-05-08 20:41 ` [PATCH net-next 1/2] " Stanislav Fomichev
@ 2026-05-08 20:41 ` Stanislav Fomichev
2026-05-10 15:35 ` Jakub Kicinski
2026-05-10 15:40 ` [PATCH net-next 0/2] tools/ynl: add missing uapi header deps in Makefile.deps patchwork-bot+netdevbpf
2 siblings, 1 reply; 5+ messages in thread
From: Stanislav Fomichev @ 2026-05-08 20:41 UTC (permalink / raw)
To: netdev
Cc: davem, edumazet, kuba, pabeni, donald.hunter, horms, sdf,
linux-kernel
Add two make rules that detect missing entries in Makefile.deps:
check-existing-deps-<family>: for families that already have CFLAGS,
parse each force-included header for #include directives and verify
that every included uapi header is either already listed in CFLAGS
or findable by the compiler without -idirafter.
check-new-deps-<family>: for families without CFLAGS, check whether
their default uapi header (linux/<family>.h) exists in the kernel
tree but is not findable by the compiler -- meaning it needs a new
CFLAGS entry.
(this is slop but I added extensive comments on how it works)
Signed-off-by: Stanislav Fomichev <sdf@fomichev.me>
---
tools/net/ynl/Makefile.deps | 35 ++++++++++++++++++++++++++++++++
tools/net/ynl/generated/Makefile | 6 +++++-
2 files changed, 40 insertions(+), 1 deletion(-)
diff --git a/tools/net/ynl/Makefile.deps b/tools/net/ynl/Makefile.deps
index cc53b2f21c44..f2c24097a2c8 100644
--- a/tools/net/ynl/Makefile.deps
+++ b/tools/net/ynl/Makefile.deps
@@ -52,3 +52,38 @@ CFLAGS_tc:= $(call get_hdr_inc,__LINUX_RTNETLINK_H,rtnetlink.h) \
$(call get_hdr_inc,_TC_TUNNEL_KEY_H,tc_act/tc_tunnel_key.h)
CFLAGS_tcp_metrics:=$(call get_hdr_inc,_LINUX_TCP_METRICS_H,tcp_metrics.h)
CFLAGS_wireguard:=$(call get_hdr_inc2,_LINUX_WIREGUARD_H,_WG_UAPI_WIREGUARD_H,wireguard.h)
+
+# For families that already have CFLAGS, verify that every #include in
+# their force-included headers is accounted for.
+#
+# How it works:
+# 1. Extract -include paths from CFLAGS_<family> (grep + sed)
+# 2. Parse each header for #include <...> directives (sed)
+# 3. Skip if the included file is not a uapi header (test against UAPI_PATH)
+# 4. Skip if it is already listed in CFLAGS_<family> (grep)
+# 5. Skip if the compiler can find it without help (try $(CC))
+# 6. Otherwise error -- the header needs to be added
+check-existing-deps-%:
+ @for inc in $$(sed -n 's/.*#include <\([^>]*\)>.*/\1/p' \
+ $$(echo "$(CFLAGS_$*)" | grep -o '\-include [^ ]*' | sed 's/-include //')); do \
+ test -f $(UAPI_PATH)/$$inc || continue; \
+ echo "$(CFLAGS_$*)" | grep -qF "$$inc" && continue; \
+ echo "#include <$$inc>" | $(CC) -x c -fsyntax-only - 2>/dev/null && continue; \
+ echo "ERROR: $* missing $$inc"; exit 1; \
+ done; true
+
+# For families without CFLAGS, check whether their default uapi header
+# (linux/<family>.h) exists in the kernel tree but is not findable by
+# the compiler -- meaning it needs a new CFLAGS entry.
+#
+# How it works (short-circuit chain, all four must fail to error):
+# 1. Skip if CFLAGS_<family> is already defined (test -n)
+# 2. Skip if the default uapi header does not exist (test -f)
+# 3. Skip if the compiler can find it without help (try $(CC))
+# 4. Otherwise error -- a new CFLAGS entry is needed
+check-new-deps-%:
+ @test -n "$(CFLAGS_$*)" \
+ || ! test -f $(UAPI_PATH)/linux/$(subst -,_,$*).h \
+ || echo "#include <linux/$(subst -,_,$*).h>" | \
+ $(CC) -x c -fsyntax-only - 2>/dev/null \
+ || { echo "ERROR: $* needs CFLAGS entry for linux/$(subst -,_,$*).h"; exit 1; }
diff --git a/tools/net/ynl/generated/Makefile b/tools/net/ynl/generated/Makefile
index 86e1e4a959a7..0f1d2c70b6a5 100644
--- a/tools/net/ynl/generated/Makefile
+++ b/tools/net/ynl/generated/Makefile
@@ -83,5 +83,9 @@ install-rsts: $(RSTS)
install: install-headers install-rsts install-specs
-.PHONY: all clean distclean regen install install-headers install-rsts install-specs
+check-deps: $(patsubst %,check-existing-deps-%,$(GENS)) \
+ $(patsubst %,check-new-deps-%,$(GENS))
+ @echo "All Makefile.deps OK"
+
+.PHONY: all clean distclean regen install install-headers install-rsts install-specs check-deps
.DEFAULT_GOAL: all
--
2.53.0-Meta
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next 2/2] tools/ynl: add check-deps target to verify Makefile.deps completeness
2026-05-08 20:41 ` [PATCH net-next 2/2] tools/ynl: add check-deps target to verify Makefile.deps completeness Stanislav Fomichev
@ 2026-05-10 15:35 ` Jakub Kicinski
0 siblings, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2026-05-10 15:35 UTC (permalink / raw)
To: Stanislav Fomichev
Cc: netdev, davem, edumazet, pabeni, donald.hunter, horms, sdf,
linux-kernel
On Fri, 8 May 2026 13:41:14 -0700 Stanislav Fomichev wrote:
> Add two make rules that detect missing entries in Makefile.deps:
>
> check-existing-deps-<family>: for families that already have CFLAGS,
> parse each force-included header for #include directives and verify
> that every included uapi header is either already listed in CFLAGS
> or findable by the compiler without -idirafter.
>
> check-new-deps-<family>: for families without CFLAGS, check whether
> their default uapi header (linux/<family>.h) exists in the kernel
> tree but is not findable by the compiler -- meaning it needs a new
> CFLAGS entry.
>
> (this is slop but I added extensive comments on how it works)
Would it be more suitable as a NIPA check? Or at least it'd feel less
bad to carry slop in NIPA than in the kernel tree. We already have a
test for YNL build.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next 0/2] tools/ynl: add missing uapi header deps in Makefile.deps
2026-05-08 20:41 [PATCH net-next 0/2] tools/ynl: add missing uapi header deps in Makefile.deps Stanislav Fomichev
2026-05-08 20:41 ` [PATCH net-next 1/2] " Stanislav Fomichev
2026-05-08 20:41 ` [PATCH net-next 2/2] tools/ynl: add check-deps target to verify Makefile.deps completeness Stanislav Fomichev
@ 2026-05-10 15:40 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-05-10 15:40 UTC (permalink / raw)
To: Stanislav Fomichev
Cc: netdev, davem, edumazet, kuba, pabeni, donald.hunter, horms, sdf,
linux-kernel
Hello:
This series was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Fri, 8 May 2026 13:41:12 -0700 you wrote:
> When syncing ynl-cpp to net-next v7.0-rc3, typelimits.h (for ethtool) and
> dev_energymodel.h had to be manually hacked into the downstream
> Makefile.deps:
>
> https://github.com/linux-netdev/ynl-cpp/pull/16/changes/94bd9656423cab7dfce73dc824f75b59ef25668d
>
> Fix the upstream Makefile.deps so that downstream copies stay in sync.
>
> [...]
Here is the summary with links:
- [net-next,1/2] tools/ynl: add missing uapi header deps in Makefile.deps
https://git.kernel.org/netdev/net/c/46e9b0224475
- [net-next,2/2] tools/ynl: add check-deps target to verify Makefile.deps completeness
(no matching commit)
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-05-10 15:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-08 20:41 [PATCH net-next 0/2] tools/ynl: add missing uapi header deps in Makefile.deps Stanislav Fomichev
2026-05-08 20:41 ` [PATCH net-next 1/2] " Stanislav Fomichev
2026-05-08 20:41 ` [PATCH net-next 2/2] tools/ynl: add check-deps target to verify Makefile.deps completeness Stanislav Fomichev
2026-05-10 15:35 ` Jakub Kicinski
2026-05-10 15:40 ` [PATCH net-next 0/2] tools/ynl: add missing uapi header deps in Makefile.deps patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox