Skip to content

Commit 6d397cf

Browse files
committed
generic: backport API from linux 6.10 for mac80211 v6.1-rc8
1 parent 3d38995 commit 6d397cf

4 files changed

+460
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
--- a/include/linux/stddef.h
2+
+++ b/include/linux/stddef.h
3+
@@ -35,5 +35,66 @@
4+
*/
5+
#define offsetofend(TYPE, MEMBER) \
6+
(offsetof(TYPE, MEMBER) + sizeof_field(TYPE, MEMBER))
7+
+
8+
+/**
9+
+ * struct_group() - Wrap a set of declarations in a mirrored struct
10+
+ *
11+
+ * @NAME: The identifier name of the mirrored sub-struct
12+
+ * @MEMBERS: The member declarations for the mirrored structs
13+
+ *
14+
+ * Used to create an anonymous union of two structs with identical
15+
+ * layout and size: one anonymous and one named. The former can be
16+
+ * used normally without sub-struct naming, and the latter can be
17+
+ * used to reason about the start, end, and size of the group of
18+
+ * struct members.
19+
+ */
20+
+#define struct_group(NAME, MEMBERS...) \
21+
+ __struct_group(/* no tag */, NAME, /* no attrs */, MEMBERS)
22+
+
23+
+/**
24+
+ * struct_group_attr() - Create a struct_group() with trailing attributes
25+
+ *
26+
+ * @NAME: The identifier name of the mirrored sub-struct
27+
+ * @ATTRS: Any struct attributes to apply
28+
+ * @MEMBERS: The member declarations for the mirrored structs
29+
+ *
30+
+ * Used to create an anonymous union of two structs with identical
31+
+ * layout and size: one anonymous and one named. The former can be
32+
+ * used normally without sub-struct naming, and the latter can be
33+
+ * used to reason about the start, end, and size of the group of
34+
+ * struct members. Includes structure attributes argument.
35+
+ */
36+
+#define struct_group_attr(NAME, ATTRS, MEMBERS...) \
37+
+ __struct_group(/* no tag */, NAME, ATTRS, MEMBERS)
38+
+
39+
+/**
40+
+ * struct_group_tagged() - Create a struct_group with a reusable tag
41+
+ *
42+
+ * @TAG: The tag name for the named sub-struct
43+
+ * @NAME: The identifier name of the mirrored sub-struct
44+
+ * @MEMBERS: The member declarations for the mirrored structs
45+
+ *
46+
+ * Used to create an anonymous union of two structs with identical
47+
+ * layout and size: one anonymous and one named. The former can be
48+
+ * used normally without sub-struct naming, and the latter can be
49+
+ * used to reason about the start, end, and size of the group of
50+
+ * struct members. Includes struct tag argument for the named copy,
51+
+ * so the specified layout can be reused later.
52+
+ */
53+
+#define struct_group_tagged(TAG, NAME, MEMBERS...) \
54+
+ __struct_group(TAG, NAME, /* no attrs */, MEMBERS)
55+
+
56+
+/**
57+
+ * DECLARE_FLEX_ARRAY() - Declare a flexible array usable in a union
58+
+ *
59+
+ * @TYPE: The type of each flexible array element
60+
+ * @NAME: The name of the flexible array member
61+
+ *
62+
+ * In order to have a flexible array member in a union or alone in a
63+
+ * struct, it needs to be wrapped in an anonymous struct with at least 1
64+
+ * named member, but that member can be empty.
65+
+ */
66+
+#define DECLARE_FLEX_ARRAY(TYPE, NAME) \
67+
+ __DECLARE_FLEX_ARRAY(TYPE, NAME)
68+
69+
#endif
70+
--- a/dev/null
71+
+++ b/tools/include/uapi/linux/stddef.h
72+
@@ -0,0 +1,47 @@
73+
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
74+
+#ifndef _LINUX_STDDEF_H
75+
+#define _LINUX_STDDEF_H
76+
+
77+
+
78+
+
79+
+#ifndef __always_inline
80+
+#define __always_inline __inline__
81+
+#endif
82+
+
83+
+/**
84+
+ * __struct_group() - Create a mirrored named and anonyomous struct
85+
+ *
86+
+ * @TAG: The tag name for the named sub-struct (usually empty)
87+
+ * @NAME: The identifier name of the mirrored sub-struct
88+
+ * @ATTRS: Any struct attributes (usually empty)
89+
+ * @MEMBERS: The member declarations for the mirrored structs
90+
+ *
91+
+ * Used to create an anonymous union of two structs with identical layout
92+
+ * and size: one anonymous and one named. The former's members can be used
93+
+ * normally without sub-struct naming, and the latter can be used to
94+
+ * reason about the start, end, and size of the group of struct members.
95+
+ * The named struct can also be explicitly tagged for layer reuse, as well
96+
+ * as both having struct attributes appended.
97+
+ */
98+
+#define __struct_group(TAG, NAME, ATTRS, MEMBERS...) \
99+
+ union { \
100+
+ struct { MEMBERS } ATTRS; \
101+
+ struct TAG { MEMBERS } ATTRS NAME; \
102+
+ }
103+
+
104+
+/**
105+
+ * __DECLARE_FLEX_ARRAY() - Declare a flexible array usable in a union
106+
+ *
107+
+ * @TYPE: The type of each flexible array element
108+
+ * @NAME: The name of the flexible array member
109+
+ *
110+
+ * In order to have a flexible array member in a union or alone in a
111+
+ * struct, it needs to be wrapped in an anonymous struct with at least 1
112+
+ * named member, but that member can be empty.
113+
+ */
114+
+#define __DECLARE_FLEX_ARRAY(TYPE, NAME) \
115+
+ struct { \
116+
+ struct { } __empty_ ## NAME; \
117+
+ TYPE NAME[]; \
118+
+ }
119+
+#endif
120+
--- a/dev/null
121+
+++ b/include/uapi/linux/stddef.h
122+
@@ -0,0 +1,47 @@
123+
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
124+
+#ifndef _UAPI_LINUX_STDDEF_H
125+
+#define _UAPI_LINUX_STDDEF_H
126+
+
127+
+#include <linux/compiler_types.h>
128+
+
129+
+#ifndef __always_inline
130+
+#define __always_inline inline
131+
+#endif
132+
+
133+
+/**
134+
+ * __struct_group() - Create a mirrored named and anonyomous struct
135+
+ *
136+
+ * @TAG: The tag name for the named sub-struct (usually empty)
137+
+ * @NAME: The identifier name of the mirrored sub-struct
138+
+ * @ATTRS: Any struct attributes (usually empty)
139+
+ * @MEMBERS: The member declarations for the mirrored structs
140+
+ *
141+
+ * Used to create an anonymous union of two structs with identical layout
142+
+ * and size: one anonymous and one named. The former's members can be used
143+
+ * normally without sub-struct naming, and the latter can be used to
144+
+ * reason about the start, end, and size of the group of struct members.
145+
+ * The named struct can also be explicitly tagged for layer reuse, as well
146+
+ * as both having struct attributes appended.
147+
+ */
148+
+#define __struct_group(TAG, NAME, ATTRS, MEMBERS...) \
149+
+ union { \
150+
+ struct { MEMBERS } ATTRS; \
151+
+ struct TAG { MEMBERS } ATTRS NAME; \
152+
+ }
153+
+
154+
+/**
155+
+ * __DECLARE_FLEX_ARRAY() - Declare a flexible array usable in a union
156+
+ *
157+
+ * @TYPE: The type of each flexible array element
158+
+ * @NAME: The name of the flexible array member
159+
+ *
160+
+ * In order to have a flexible array member in a union or alone in a
161+
+ * struct, it needs to be wrapped in an anonymous struct with at least 1
162+
+ * named member, but that member can be empty.
163+
+ */
164+
+#define __DECLARE_FLEX_ARRAY(TYPE, NAME) \
165+
+ struct { \
166+
+ struct { } __empty_ ## NAME; \
167+
+ TYPE NAME[]; \
168+
+ }
169+
+#endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
--- a/include/linux/netdevice.h
2+
+++ b/include/linux/netdevice.h
3+
@@ -838,6 +838,61 @@
4+
struct sk_buff *skb,
5+
struct net_device *sb_dev);
6+
7+
+enum net_device_path_type {
8+
+ DEV_PATH_ETHERNET = 0,
9+
+ DEV_PATH_VLAN,
10+
+ DEV_PATH_BRIDGE,
11+
+ DEV_PATH_PPPOE,
12+
+ DEV_PATH_DSA,
13+
+ DEV_PATH_MTK_WDMA,
14+
+};
15+
+
16+
+struct net_device_path {
17+
+ enum net_device_path_type type;
18+
+ const struct net_device *dev;
19+
+ union {
20+
+ struct {
21+
+ u16 id;
22+
+ __be16 proto;
23+
+ u8 h_dest[ETH_ALEN];
24+
+ } encap;
25+
+ struct {
26+
+ enum {
27+
+ DEV_PATH_BR_VLAN_KEEP,
28+
+ DEV_PATH_BR_VLAN_TAG,
29+
+ DEV_PATH_BR_VLAN_UNTAG,
30+
+ DEV_PATH_BR_VLAN_UNTAG_HW,
31+
+ } vlan_mode;
32+
+ u16 vlan_id;
33+
+ __be16 vlan_proto;
34+
+ } bridge;
35+
+ struct {
36+
+ int port;
37+
+ u16 proto;
38+
+ } dsa;
39+
+ struct {
40+
+ u8 wdma_idx;
41+
+ u8 queue;
42+
+ u16 wcid;
43+
+ u8 bss;
44+
+ } mtk_wdma;
45+
+ };
46+
+};
47+
+
48+
+#define NET_DEVICE_PATH_STACK_MAX 5
49+
+#define NET_DEVICE_PATH_VLAN_MAX 2
50+
+
51+
+struct net_device_path_ctx {
52+
+ const struct net_device *dev;
53+
+ u8 daddr[ETH_ALEN];
54+
+
55+
+ int num_vlans;
56+
+ struct {
57+
+ u16 id;
58+
+ __be16 proto;
59+
+ } vlan[NET_DEVICE_PATH_VLAN_MAX];
60+
+};
61+
+
62+
enum tc_setup_type {
63+
TC_SETUP_QDISC_MQPRIO,
64+
TC_SETUP_CLSU32,
65+
@@ -1468,6 +1523,8 @@
66+
u32 flags);
67+
int (*ndo_xsk_wakeup)(struct net_device *dev,
68+
u32 queue_id, u32 flags);
69+
+ int (*ndo_fill_forward_path)(struct net_device_path_ctx *ctx,
70+
+ struct net_device_path *path);
71+
struct devlink_port * (*ndo_get_devlink_port)(struct net_device *dev);
72+
};
73+

0 commit comments

Comments
 (0)