• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Fundamental types and constants relating to 802.11s Mesh
3  *
4  * Copyright (C) 1999-2019, Broadcom.
5  *
6  *      Unless you and Broadcom execute a separate written software license
7  * agreement governing use of this software, this software is licensed to you
8  * under the terms of the GNU General Public License version 2 (the "GPL"),
9  * available at http://www.broadcom.com/licenses/GPLv2.php, with the
10  * following added to such license:
11  *
12  *      As a special exception, the copyright holders of this software give you
13  * permission to link this software with independent modules, and to copy and
14  * distribute the resulting executable under terms of your choice, provided that
15  * you also meet, for each linked independent module, the terms and conditions
16  * of the license of that module.  An independent module is a module which is
17  * not derived from this software.  The special exception does not apply to any
18  * modifications of the software.
19  *
20  *      Notwithstanding the above, under no circumstances may you combine this
21  * software in any way with any other Broadcom software provided under a license
22  * other than the GPL, without Broadcom's express prior written consent.
23  *
24  *
25  * <<Broadcom-WL-IPTag/Open:>>
26  *
27  * $Id: 802.11s.h 700076 2017-05-17 14:42:22Z $
28  */
29 
30 #ifndef _802_11s_h_
31 #define _802_11s_h_
32 
33 /* This marks the start of a packed structure section. */
34 #include <packed_section_start.h>
35 
36 #define DOT11_MESH_FLAGS_AE_MASK 0x3
37 #define DOT11_MESH_FLAGS_AE_SHIFT 0
38 
39 #define DOT11_MESH_CONNECTED_AS_SET 7
40 #define DOT11_MESH_NUMBER_PEERING_SET 1
41 #define DOT11_MESH_MESH_GWSET 0
42 
43 #define DOT11_MESH_ACTION_LINK_MET_REP 0
44 #define DOT11_MESH_ACTION_PATH_SEL 1
45 #define DOT11_MESH_ACTION_GATE_ANN 2
46 #define DOT11_MESH_ACTION_CONG_CONT_NOTIF 3
47 #define DOT11_MESH_ACTION_MCCA_SETUP_REQ 4
48 #define DOT11_MESH_ACTION_MCCA_SETUP_REP 5
49 #define DOT11_MESH_ACTION_MCCA_ADVT_REQ 6
50 #define DOT11_MESH_ACTION_MCCA_ADVT 7
51 #define DOT11_MESH_ACTION_MCCA_TEARDOWN 8
52 #define DOT11_MESH_ACTION_TBTT_ADJ_REQ 9
53 #define DOT11_MESH_ACTION_TBTT_ADJ_RESP 10
54 
55 /* self-protected action field values: 7-57v24 */
56 #define DOT11_SELFPROT_ACTION_MESH_PEER_OPEN 1
57 #define DOT11_SELFPROT_ACTION_MESH_PEER_CONFM 2
58 #define DOT11_SELFPROT_ACTION_MESH_PEER_CLOSE 3
59 #define DOT11_SELFPROT_ACTION_MESH_PEER_GK_INF 4
60 #define DOT11_SELFPROT_ACTION_MESH_PEER_GK_ACK 5
61 
62 #define DOT11_MESH_AUTH_PROTO_NONE 0
63 #define DOT11_MESH_AUTH_PROTO_SAE 1
64 #define DOT11_MESH_AUTH_PROTO_8021X 2
65 #define DOT11_MESH_AUTH_PROTO_VS 255
66 
67 #define DOT11_MESH_PATHSEL_LEN 2
68 #define DOT11_MESH_PERR_LEN1 2  /* Least PERR length fixed */
69 #define DOT11_MESH_PERR_LEN2 13 /* Least PERR length variable */
70 #define DOT11_MESH_PREP_LEN 31  /* Least PREP length */
71 #define DOT11_MESH_PREQ_LEN 37  /* Least PREQ length */
72 
73 #define DOT11_MESH_PATHSEL_PROTID_HWMP 1
74 #define DOT11_MESH_PATHSEL_METRICID_ALM 1 /* Air link metric */
75 #define DOT11_MESH_CONGESTCTRL_NONE 0
76 #define DOT11_MESH_CONGESTCTRL_SP 1
77 #define DOT11_MESH_SYNCMETHOD_NOFFSET 1
78 
79 BWL_PRE_PACKED_STRUCT struct dot11_meshctrl_hdr {
80     uint8 flags;          /* flag bits such as ae etc */
81     uint8 ttl;            /* time to live */
82     uint32 seq;           /* sequence control */
83     struct ether_addr a5; /* optional address 5 */
84     struct ether_addr a6; /* optional address 6 */
85 } BWL_POST_PACKED_STRUCT;
86 
87 /* Mesh Path Selection Action Frame */
88 BWL_PRE_PACKED_STRUCT struct dot11_mesh_pathsel {
89     uint8 category;
90     uint8 meshaction;
91     uint8 data[];
92 } BWL_POST_PACKED_STRUCT;
93 typedef struct dot11_mesh_pathsel dot11_mesh_pathsel_t;
94 
95 /*  Mesh PREQ IE */
96 BWL_PRE_PACKED_STRUCT struct mesh_preq_ie {
97     uint8 id;
98     uint8 len;
99     uint8 flags;
100     uint8 hop_count;
101     uint8 ttl;
102     uint32 pathdis_id;
103     struct ether_addr originator_addr;
104     uint32 originator_seq;
105     union {
106         BWL_PRE_PACKED_STRUCT struct {
107             struct ether_addr target_ext_add;
108             uint32 lifetime;
109             uint32 metric;
110             uint8 target_count;
111             uint8 data[];
112         } BWL_POST_PACKED_STRUCT oea;
113 
114         BWL_PRE_PACKED_STRUCT struct {
115             uint32 lifetime;
116             uint32 metric;
117             uint8 target_count;
118             uint8 data[];
119         } BWL_POST_PACKED_STRUCT noea;
120     } u;
121 } BWL_POST_PACKED_STRUCT;
122 typedef struct mesh_preq_ie mesh_preq_ie_t;
123 
124 /* Target info (part of Mesh PREQ IE) */
125 BWL_PRE_PACKED_STRUCT struct mesh_targetinfo {
126     uint8 target_flag;
127     struct ether_addr target_addr;
128     uint32 target_seq;
129 } BWL_POST_PACKED_STRUCT;
130 typedef struct mesh_targetinfo mesh_targetinfo_t;
131 
132 /* Mesh PREP IE */
133 BWL_PRE_PACKED_STRUCT struct mesh_prep_ie {
134     uint8 id;
135     uint8 len;
136     uint8 flags;
137     uint8 hop_count;
138     uint8 ttl;
139     struct ether_addr target_addr;
140     uint32 target_seq;
141     union {
142         BWL_PRE_PACKED_STRUCT struct {
143             struct ether_addr target_ext_add;
144             uint32 lifetime;
145             uint32 metric;
146             uint8 target_count;
147             struct ether_addr originator_addr;
148             uint32 originator_seq;
149         } BWL_POST_PACKED_STRUCT oea;
150 
151         BWL_PRE_PACKED_STRUCT struct {
152             uint32 lifetime;
153             uint32 metric;
154             uint8 target_count;
155             struct ether_addr originator_addr;
156             uint32 originator_seq;
157         } BWL_POST_PACKED_STRUCT noea;
158     } u;
159 } BWL_POST_PACKED_STRUCT;
160 typedef struct mesh_prep_ie mesh_prep_ie_t;
161 
162 /* Mesh PERR IE */
163 struct mesh_perr_ie {
164     uint8 id;
165     uint8 len;
166     uint8 ttl;
167     uint8 num_dest;
168     uint8 data[];
169 };
170 typedef struct mesh_perr_ie mesh_perr_ie_t;
171 
172 /* Destination info is part of PERR IE */
173 BWL_PRE_PACKED_STRUCT struct mesh_perr_destinfo {
174     uint8 flags;
175     struct ether_addr destination_addr;
176     uint32 dest_seq;
177     union {
178         BWL_PRE_PACKED_STRUCT struct {
179             struct ether_addr dest_ext_addr;
180         } BWL_POST_PACKED_STRUCT dea;
181 
182         BWL_PRE_PACKED_STRUCT struct {
183             /* 1 byte reason code to be populated manually in software */
184             uint16 reason_code;
185         } BWL_POST_PACKED_STRUCT nodea;
186     } u;
187 } BWL_POST_PACKED_STRUCT;
188 typedef struct mesh_perr_destinfo mesh_perr_destinfo_t;
189 
190 /* Mesh peering action frame hdr */
191 BWL_PRE_PACKED_STRUCT struct mesh_peering_frmhdr {
192     uint8 category;
193     uint8 action;
194     union {
195         struct {
196             uint16 capability;
197         } open;
198         struct {
199             uint16 capability;
200             uint16 AID;
201         } confirm;
202         uint8 data[1];
203     } u;
204 } BWL_POST_PACKED_STRUCT;
205 typedef struct mesh_peering_frmhdr mesh_peering_frmhdr_t;
206 
207 /* Mesh peering mgmt IE */
208 BWL_PRE_PACKED_STRUCT struct mesh_peer_mgmt_ie_common {
209     uint16 mesh_peer_prot_id;
210     uint16 local_link_id;
211 } BWL_POST_PACKED_STRUCT;
212 typedef struct mesh_peer_mgmt_ie_common mesh_peer_mgmt_ie_common_t;
213 #define MESH_PEER_MGMT_IE_OPEN_LEN (4)
214 
215 BWL_PRE_PACKED_STRUCT struct mesh_peer_mgmt_ie_cfm {
216     mesh_peer_mgmt_ie_common_t common;
217     uint16 peer_link_id;
218 } BWL_POST_PACKED_STRUCT;
219 typedef struct mesh_peer_mgmt_ie_cfm mesh_peer_mgmt_ie_cfm_t;
220 #define MESH_PEER_MGMT_IE_CONF_LEN (6)
221 
222 BWL_PRE_PACKED_STRUCT struct mesh_peer_mgmt_ie_close {
223     mesh_peer_mgmt_ie_common_t common;
224     /* uint16	peer_link_id;
225      * simplicity: not supported, for future
226      */
227     uint16 reason_code;
228 } BWL_POST_PACKED_STRUCT;
229 typedef struct mesh_peer_mgmt_ie_close mesh_peer_mgmt_ie_close_t;
230 #define MESH_PEER_MGMT_IE_CLOSE_LEN (6)
231 
232 struct mesh_config_ie {
233     uint8 activ_path_sel_prot_id;
234     uint8 activ_path_sel_metric_id;
235     uint8 cong_ctl_mode_id;
236     uint8 sync_method_id;
237     uint8 auth_prot_id;
238     uint8 mesh_formation_info;
239     uint8 mesh_cap;
240 };
241 typedef struct mesh_config_ie mesh_config_ie_t;
242 #define MESH_CONFIG_IE_LEN (7)
243 
244 /* Mesh peering states */
245 #define MESH_PEERING_IDLE 0
246 #define MESH_PEERING_OPEN_SNT 1
247 #define MESH_PEERING_CNF_RCVD 2
248 #define MESH_PEERING_OPEN_RCVD 3
249 #define MESH_PEERING_ESTAB 4
250 #define MESH_PEERING_HOLDING 5
251 #define MESH_PEERING_LAST_STATE 6
252 /* for debugging: mapping strings */
253 #define MESH_PEERING_STATE_STRINGS                                             \
254     {                                                                          \
255         "IDLE  ", "OPNSNT", "CNFRCV", "OPNRCV", "ESTAB ", "HOLDNG"             \
256     }
257 
258 #ifdef WLMESH
259 typedef BWL_PRE_PACKED_STRUCT struct mesh_peer_info {
260     /* mesh_peer_instance as given in the spec. Note that, peer address
261      * is stored in scb
262      */
263     uint16 mesh_peer_prot_id;
264     uint16 local_link_id;
265     uint16 peer_link_id;
266     /* AID generated by *peer* to self & received in peer_confirm */
267     uint16 peer_aid;
268 
269     /* no mention in spec? possibly used in PS case. Note that aid
270      * generated from self to peer is stored in scb.
271      */
272     uint8 state;
273     /* struct mesh_peer_info *next; this field is required
274      * if multiple peerings per same src is allowed, which is
275      * true as per spec.
276      */
277 } BWL_POST_PACKED_STRUCT mesh_peer_info_t;
278 
279 typedef BWL_PRE_PACKED_STRUCT struct mesh_peer_info_ext {
280     mesh_peer_info_t peer_info;
281     uint16 local_aid;     /* AID generated by *local* to peer */
282     struct ether_addr ea; /* peer ea */
283     uint32 entry_state;   /* see MESH_PEER_ENTRY_STATE_ACTIVE etc; valid
284                            * ONLY for internal peering requests
285                            */
286     int rssi;
287 } BWL_POST_PACKED_STRUCT mesh_peer_info_ext_t;
288 
289 /* #ifdef WLMESH */
290 typedef BWL_PRE_PACKED_STRUCT struct mesh_peer_info_dump {
291     uint32 buflen;
292     uint32 version;
293     uint32 count; /* number of results */
294     mesh_peer_info_ext_t mpi_ext[1];
295 } BWL_POST_PACKED_STRUCT mesh_peer_info_dump_t;
296 #define WL_MESH_PEER_RES_FIXED_SIZE                                            \
297     (sizeof(mesh_peer_info_dump_t) - sizeof(mesh_peer_info_ext_t))
298 
299 #endif /* WLMESH */
300 
301 /* once an entry is added into mesh_peer_list, if peering is lost, it will
302  * get retried for peering, MAX_MESH_PEER_ENTRY_RETRIES times. after wards, it
303  * wont get retried and will be moved to MESH_PEER_ENTRY_STATE_TIMEDOUT state,
304  * until user adds it again explicitely, when its entry_state is changed
305  * to MESH_PEER_ENTRY_STATE_ACTIVE and tried again.
306  */
307 #define MAX_MESH_SELF_PEER_ENTRY_RETRIES 3
308 #define MESH_SELF_PEER_ENTRY_STATE_ACTIVE 1
309 #define MESH_SELF_PEER_ENTRY_STATE_TIMEDOUT 2
310 
311 /** Mesh Channel Switch Parameter IE data structure */
312 BWL_PRE_PACKED_STRUCT struct dot11_mcsp_body {
313     uint8 ttl;         /* remaining number of hops allowed for this element. */
314     uint8 flags;       /* attributes of this channel switch attempt */
315     uint8 reason;      /* reason for the mesh channel switch */
316     uint16 precedence; /* random value in the range 0 to 65535 */
317 } BWL_POST_PACKED_STRUCT;
318 
319 #define DOT11_MCSP_TTL_DEFAULT 1
320 #define DOT11_MCSP_FLAG_TRANS_RESTRICT                                         \
321     0x1                            /* no transmit except frames with mcsp */
322 #define DOT11_MCSP_FLAG_INIT 0x2   /* initiates the channel switch attempt */
323 #define DOT11_MCSP_FLAG_REASON 0x4 /* validity of reason code field */
324 #define DOT11_MCSP_REASON_REGULATORY 0  /* meet regulatory requirements */
325 #define DOT11_MCSP_REASON_UNSPECIFIED 1 /* unspecified reason */
326 
327 BWL_PRE_PACKED_STRUCT struct dot11_mesh_csp {
328     uint8 id;                    /* id DOT11_MNG_MESH_CSP_ID */
329     uint8 len;                   /* length of IE */
330     struct dot11_mcsp_body body; /* body of the ie */
331 } BWL_POST_PACKED_STRUCT;
332 typedef struct dot11_mesh_csp dot11_mesh_csp_ie_t;
333 #define DOT11_MESH_CSP_IE_LEN                                                  \
334     5 /* length of mesh channel switch parameter IE body */
335 
336 /* This marks the end of a packed structure section. */
337 #include <packed_section_end.h>
338 
339 #endif /* #ifndef _802_11s_H_ */
340