Skip to contentSkip to conversation

net: reorganize IP MIB values (II)

PATCH Applied Eric Dumazet 3 participants 3 messages Mar 20, 2025 – Dec 11, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: reorganize IP MIB values (II)

Commit 14a196807482 ("net: reorganize IP MIB values") changed MIB values to group hot fields together.

Since then 5 new fields have been added without caring about data locality.

This patch moves IPSTATS_MIB_OUTPKTS, IPSTATS_MIB_NOECTPKTS, IPSTATS_MIB_ECT1PKTS, IPSTATS_MIB_ECT0PKTS, IPSTATS_MIB_CEPKTS to the hot portion of per-cpu data.

---
 include/uapi/linux/snmp.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
include/uapi/linux/snmp.h +6 -6
index eb9fb776fdc3e50c2ecfc6b36d5472f8f65b5985..ec47f9b68a1bfb1908f2197555c876424481ab1c 100644
@@ -23,9 +23,14 @@ enum
 	IPSTATS_MIB_INPKTS,			/* InReceives */
 	IPSTATS_MIB_INOCTETS,			/* InOctets */
 	IPSTATS_MIB_INDELIVERS,			/* InDelivers */
-	IPSTATS_MIB_OUTFORWDATAGRAMS,		/* OutForwDatagrams */
+	IPSTATS_MIB_NOECTPKTS,			/* InNoECTPkts */
+	IPSTATS_MIB_ECT1PKTS,			/* InECT1Pkts */
+	IPSTATS_MIB_ECT0PKTS,			/* InECT0Pkts */
+	IPSTATS_MIB_CEPKTS,			/* InCEPkts */
 	IPSTATS_MIB_OUTREQUESTS,		/* OutRequests */
+	IPSTATS_MIB_OUTPKTS,			/* OutTransmits */
 	IPSTATS_MIB_OUTOCTETS,			/* OutOctets */
+	IPSTATS_MIB_OUTFORWDATAGRAMS,		/* OutForwDatagrams */
 /* other fields */
 	IPSTATS_MIB_INHDRERRORS,		/* InHdrErrors */
 	IPSTATS_MIB_INTOOBIGERRORS,		/* InTooBigErrors */
@@ -52,12 +57,7 @@ enum
 	IPSTATS_MIB_INBCASTOCTETS,		/* InBcastOctets */
 	IPSTATS_MIB_OUTBCASTOCTETS,		/* OutBcastOctets */
 	IPSTATS_MIB_CSUMERRORS,			/* InCsumErrors */
-	IPSTATS_MIB_NOECTPKTS,			/* InNoECTPkts */
-	IPSTATS_MIB_ECT1PKTS,			/* InECT1Pkts */
-	IPSTATS_MIB_ECT0PKTS,			/* InECT0Pkts */
-	IPSTATS_MIB_CEPKTS,			/* InCEPkts */
 	IPSTATS_MIB_REASM_OVERLAPS,		/* ReasmOverlaps */
-	IPSTATS_MIB_OUTPKTS,			/* OutTransmits */
 	__IPSTATS_MIB_MAX
 };
 
Signature · 1 line
2.49.0.rc1.451.g8f38331e32-goog
#1 lore raw
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 11 lines · On Thu, 20 Mar 2025 10:14:34 +0000 you wrote:

Commit 14a196807482 ("net: reorganize IP MIB values") changed MIB values to group hot fields together.

Since then 5 new fields have been added without caring about data locality.

This patch moves IPSTATS_MIB_OUTPKTS, IPSTATS_MIB_NOECTPKTS, IPSTATS_MIB_ECT1PKTS, IPSTATS_MIB_ECT0PKTS, IPSTATS_MIB_CEPKTS to the hot portion of per-cpu data.

[...]

Here is the summary with links:
- [net-next] net: reorganize IP MIB values (II)

    https://git.kernel.org/netdev/net-next/c/652e2c777862

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
#2 lore raw
In reply to Eric Dumazet
Quoted 9 lines · Eric Dumazet

Commit 14a196807482 ("net: reorganize IP MIB values") changed MIB values to group hot fields together.

Since then 5 new fields have been added without caring about data locality.

This patch moves IPSTATS_MIB_OUTPKTS, IPSTATS_MIB_NOECTPKTS, IPSTATS_MIB_ECT1PKTS, IPSTATS_MIB_ECT0PKTS, IPSTATS_MIB_CEPKTS to the hot portion of per-cpu data.

Hi,

the patch

https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=652e2c777862c869966082fec98174640ab20dc9

reorders the enum values in the user space header. It's not only done by this patch, for example also b4a11b2033b7d3dfdd46592f7036a775b18cecd1. Similarly, the LINUX_MIB_* enums keep changing.

This seems problematic to me. For example, iproute2 does:

https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/tree/lib/utils.c?id=24a5a424e3a0b3d85dd035540d874dd769ecb2d3#n1536

which only works as long as the kernel headers (at compile time) are in sync with the running kernel. That is often not the case, for example with containers.

libnl3 also is affected and tries to (badly) workaround this:

https://github.com/thom311/libnl/commit/5981a39583ab65dca230a8ee70625626d9ec9fc8

How do you suggest should API users handle this? In the future, would it be possible to keep the API stable and backward compatible?

Thank you,
Thomas