Vivien Didelot
2019-Dec-11 21:47 UTC
[Bridge] [PATCH net-next v2] net: bridge: add STP xstats
Hi David, On Wed, 11 Dec 2019 12:01:20 -0800 (PST), David Miller <davem at davemloft.net> wrote:> >> >> /* Bridge multicast database attributes > >> >> * [MDBA_MDB] = { > >> >> * [MDBA_MDB_ENTRY] = { > >> >> @@ -261,6 +270,7 @@ enum { > >> >> BRIDGE_XSTATS_UNSPEC, > >> >> BRIDGE_XSTATS_VLAN, > >> >> BRIDGE_XSTATS_MCAST, > >> >> + BRIDGE_XSTATS_STP, > >> >> BRIDGE_XSTATS_PAD, > >> >> __BRIDGE_XSTATS_MAX > >> >> }; > >> > > >> > Shouldn't the new entry be appended to the end - after BRIDGE_XSTATS_PAD > >> > > >> > >> Oh yes, good catch. That has to be fixed, too. > >> > > > > This I don't get. Why new attributes must come between BRIDGE_XSTATS_PAD > > and __BRIDGE_XSTATS_MAX? > > Because, just like any other attribute value, BRIDGE_XSTATS_PAD is an > API and fixed in stone. You can't add things before it which change > it's value.I thought the whole point of using enums was to avoid caring about fixed numeric values, but well. To be more precise, what I don't get is that when I move the BRIDGE_XSTATS_STP definition *after* BRIDGE_XSTATS_PAD, the STP xstats don't show up anymore in iproute2. Thanks, Vivien
David Miller
2019-Dec-11 22:16 UTC
[Bridge] [PATCH net-next v2] net: bridge: add STP xstats
From: Vivien Didelot <vivien.didelot at gmail.com> Date: Wed, 11 Dec 2019 16:47:54 -0500> I thought the whole point of using enums was to avoid caring about fixed > numeric values, but well.I don't get where you got that idea from. Each and every netlink attribute value is like IPPROTO_TCP in an ipv4 header, the exact values matter, and therefore you cannot make changes that modify existing values. Therefore, you must add new attributes to the end of the enumberation, right before the __MAX value.> To be more precise, what I don't get is that when > I move the BRIDGE_XSTATS_STP definition *after* BRIDGE_XSTATS_PAD, the STP > xstats don't show up anymore in iproute2.Because you ahve to recompile iproute2 so that it uses the corrected value in the kernel header, did you do that?