]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
UAPI: net/sched: Use __struct_group() in flex struct tc_u32_sel
authorGustavo A. R. Silva <gustavoars@kernel.org>
Tue, 13 Aug 2024 22:15:02 +0000 (16:15 -0600)
committerJakub Kicinski <kuba@kernel.org>
Thu, 15 Aug 2024 03:37:47 +0000 (20:37 -0700)
Use the `__struct_group()` helper to create a new tagged
`struct tc_u32_sel_hdr`. This structure groups together all the
members of the flexible `struct tc_u32_sel` except the flexible
array. As a result, the array is effectively separated from the
rest of the members without modifying the memory layout of the
flexible structure.

This new tagged struct will be used to fix problematic declarations
of middle-flex-arrays in composite structs[1].

[1] https://git.kernel.org/linus/d88cabfd9abc

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://patch.msgid.link/e59fe833564ddc5b2cc83056a4c504be887d6193.1723586870.git.gustavoars@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/uapi/linux/pkt_cls.h

index d36d9cdf0c00830d2d249d7411350b594a05bf45..2c32080416b5a3cc0472a7d368fe34e386fa8cc0 100644 (file)
@@ -246,16 +246,19 @@ struct tc_u32_key {
 };
 
 struct tc_u32_sel {
-       unsigned char           flags;
-       unsigned char           offshift;
-       unsigned char           nkeys;
-
-       __be16                  offmask;
-       __u16                   off;
-       short                   offoff;
-
-       short                   hoff;
-       __be32                  hmask;
+       /* New members MUST be added within the __struct_group() macro below. */
+       __struct_group(tc_u32_sel_hdr, hdr, /* no attrs */,
+               unsigned char           flags;
+               unsigned char           offshift;
+               unsigned char           nkeys;
+
+               __be16                  offmask;
+               __u16                   off;
+               short                   offoff;
+
+               short                   hoff;
+               __be32                  hmask;
+       );
        struct tc_u32_key       keys[];
 };