Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
nu11secur1ty
GitHub Repository: nu11secur1ty/Kali-Linux
Path: blob/master/ALFA-W1F1/RTL8814AU/core/mesh/rtw_mesh.h
1307 views
1
/******************************************************************************
2
*
3
* Copyright(c) 2007 - 2017 Realtek Corporation.
4
*
5
* This program is free software; you can redistribute it and/or modify it
6
* under the terms of version 2 of the GNU General Public License as
7
* published by the Free Software Foundation.
8
*
9
* This program is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12
* more details.
13
*
14
*****************************************************************************/
15
#ifndef __RTW_MESH_H_
16
#define __RTW_MESH_H_
17
18
#ifndef CONFIG_AP_MODE
19
#error "CONFIG_RTW_MESH can't be enabled when CONFIG_AP_MODE is not defined\n"
20
#endif
21
22
#define RTW_MESH_TTL 31
23
#define RTW_MESH_PERR_MIN_INT 100
24
#define RTW_MESH_DEFAULT_ELEMENT_TTL 31
25
#define RTW_MESH_RANN_INTERVAL 5000
26
#define RTW_MESH_PATH_TO_ROOT_TIMEOUT 6000
27
#define RTW_MESH_DIAM_TRAVERSAL_TIME 50
28
#define RTW_MESH_PATH_TIMEOUT 5000
29
#define RTW_MESH_PREQ_MIN_INT 10
30
#define RTW_MESH_MAX_PREQ_RETRIES 4
31
#define RTW_MESH_MIN_DISCOVERY_TIMEOUT (2 * RTW_MESH_DIAM_TRAVERSAL_TIME)
32
#define RTW_MESH_ROOT_CONFIRMATION_INTERVAL 2000
33
#define RTW_MESH_PATH_REFRESH_TIME 1000
34
#define RTW_MESH_ROOT_INTERVAL 5000
35
36
#define RTW_MESH_SANE_METRIC_DELTA 100
37
#define RTW_MESH_MAX_ROOT_ADD_CHK_CNT 2
38
39
#define RTW_MESH_PLINK_UNKNOWN 0
40
#define RTW_MESH_PLINK_LISTEN 1
41
#define RTW_MESH_PLINK_OPN_SNT 2
42
#define RTW_MESH_PLINK_OPN_RCVD 3
43
#define RTW_MESH_PLINK_CNF_RCVD 4
44
#define RTW_MESH_PLINK_ESTAB 5
45
#define RTW_MESH_PLINK_HOLDING 6
46
#define RTW_MESH_PLINK_BLOCKED 7
47
48
extern const char *_rtw_mesh_plink_str[];
49
#define rtw_mesh_plink_str(s) ((s <= RTW_MESH_PLINK_BLOCKED) ? _rtw_mesh_plink_str[s] : _rtw_mesh_plink_str[RTW_MESH_PLINK_UNKNOWN])
50
51
#define RTW_MESH_PS_UNKNOWN 0
52
#define RTW_MESH_PS_ACTIVE 1
53
#define RTW_MESH_PS_LSLEEP 2
54
#define RTW_MESH_PS_DSLEEP 3
55
56
extern const char *_rtw_mesh_ps_str[];
57
#define rtw_mesh_ps_str(mps) ((mps <= RTW_MESH_PS_DSLEEP) ? _rtw_mesh_ps_str[mps] : _rtw_mesh_ps_str[RTW_MESH_PS_UNKNOWN])
58
59
#define GET_MESH_CONF_ELE_PATH_SEL_PROTO_ID(_iec) LE_BITS_TO_1BYTE(((u8 *)(_iec)) + 0, 0, 8)
60
#define GET_MESH_CONF_ELE_PATH_SEL_METRIC_ID(_iec) LE_BITS_TO_1BYTE(((u8 *)(_iec)) + 1, 0, 8)
61
#define GET_MESH_CONF_ELE_CONGEST_CTRL_MODE_ID(_iec) LE_BITS_TO_1BYTE(((u8 *)(_iec)) + 2, 0, 8)
62
#define GET_MESH_CONF_ELE_SYNC_METHOD_ID(_iec) LE_BITS_TO_1BYTE(((u8 *)(_iec)) + 3, 0, 8)
63
#define GET_MESH_CONF_ELE_AUTH_PROTO_ID(_iec) LE_BITS_TO_1BYTE(((u8 *)(_iec)) + 4, 0, 8)
64
65
#define GET_MESH_CONF_ELE_MESH_FORMATION(_iec) LE_BITS_TO_1BYTE(((u8 *)(_iec)) + 5, 0, 8)
66
#define GET_MESH_CONF_ELE_CTO_MGATE(_iec) LE_BITS_TO_1BYTE(((u8 *)(_iec)) + 5, 0, 1)
67
#define GET_MESH_CONF_ELE_NUM_OF_PEERINGS(_iec) LE_BITS_TO_1BYTE(((u8 *)(_iec)) + 5, 1, 6)
68
#define GET_MESH_CONF_ELE_CTO_AS(_iec) LE_BITS_TO_1BYTE(((u8 *)(_iec)) + 5, 7, 1)
69
70
#define GET_MESH_CONF_ELE_MESH_CAP(_iec) LE_BITS_TO_1BYTE(((u8 *)(_iec)) + 6, 0, 8)
71
#define GET_MESH_CONF_ELE_ACCEPT_PEERINGS(_iec) LE_BITS_TO_1BYTE(((u8 *)(_iec)) + 6, 0, 1)
72
#define GET_MESH_CONF_ELE_MCCA_SUP(_iec) LE_BITS_TO_1BYTE(((u8 *)(_iec)) + 6, 1, 1)
73
#define GET_MESH_CONF_ELE_MCCA_EN(_iec) LE_BITS_TO_1BYTE(((u8 *)(_iec)) + 6, 2, 1)
74
#define GET_MESH_CONF_ELE_FORWARDING(_iec) LE_BITS_TO_1BYTE(((u8 *)(_iec)) + 6, 3, 1)
75
#define GET_MESH_CONF_ELE_MBCA_EN(_iec) LE_BITS_TO_1BYTE(((u8 *)(_iec)) + 6, 4, 1)
76
#define GET_MESH_CONF_ELE_TBTT_ADJ(_iec) LE_BITS_TO_1BYTE(((u8 *)(_iec)) + 6, 5, 1)
77
#define GET_MESH_CONF_ELE_PS_LEVEL(_iec) LE_BITS_TO_1BYTE(((u8 *)(_iec)) + 6, 6, 1)
78
79
#define SET_MESH_CONF_ELE_PATH_SEL_PROTO_ID(_iec, _val) SET_BITS_TO_LE_1BYTE(((u8 *)(_iec)) + 0, 0, 8, _val)
80
#define SET_MESH_CONF_ELE_PATH_SEL_METRIC_ID(_iec, _val) SET_BITS_TO_LE_1BYTE(((u8 *)(_iec)) + 1, 0, 8, _val)
81
#define SET_MESH_CONF_ELE_CONGEST_CTRL_MODE_ID(_iec, _val) SET_BITS_TO_LE_1BYTE(((u8 *)(_iec)) + 2, 0, 8, _val)
82
#define SET_MESH_CONF_ELE_SYNC_METHOD_ID(_iec, _val) SET_BITS_TO_LE_1BYTE(((u8 *)(_iec)) + 3, 0, 8, _val)
83
#define SET_MESH_CONF_ELE_AUTH_PROTO_ID(_iec, _val) SET_BITS_TO_LE_1BYTE(((u8 *)(_iec)) + 4, 0, 8, _val)
84
85
#define SET_MESH_CONF_ELE_CTO_MGATE(_iec, _val) SET_BITS_TO_LE_1BYTE(((u8 *)(_iec)) + 5, 0, 1, _val)
86
#define SET_MESH_CONF_ELE_NUM_OF_PEERINGS(_iec, _val) SET_BITS_TO_LE_1BYTE(((u8 *)(_iec)) + 5, 1, 6, _val)
87
#define SET_MESH_CONF_ELE_CTO_AS(_iec, _val) SET_BITS_TO_LE_1BYTE(((u8 *)(_iec)) + 5, 7, 1, _val)
88
89
#define SET_MESH_CONF_ELE_ACCEPT_PEERINGS(_iec, _val) SET_BITS_TO_LE_1BYTE(((u8 *)(_iec)) + 6, 0, 1, _val)
90
#define SET_MESH_CONF_ELE_MCCA_SUP(_iec, _val) SET_BITS_TO_LE_1BYTE(((u8 *)(_iec)) + 6, 1, 1, _val)
91
#define SET_MESH_CONF_ELE_MCCA_EN(_iec, _val) SET_BITS_TO_LE_1BYTE(((u8 *)(_iec)) + 6, 2, 1, _val)
92
#define SET_MESH_CONF_ELE_FORWARDING(_iec, _val) SET_BITS_TO_LE_1BYTE(((u8 *)(_iec)) + 6, 3, 1, _val)
93
#define SET_MESH_CONF_ELE_MBCA_EN(_iec, _val) SET_BITS_TO_LE_1BYTE(((u8 *)(_iec)) + 6, 4, 1, _val)
94
#define SET_MESH_CONF_ELE_TBTT_ADJ(_iec, _val) SET_BITS_TO_LE_1BYTE(((u8 *)(_iec)) + 6, 5, 1, _val)
95
#define SET_MESH_CONF_ELE_PS_LEVEL(_iec, _val) SET_BITS_TO_LE_1BYTE(((u8 *)(_iec)) + 6, 6, 1, _val)
96
97
/* Mesh flags */
98
#define MESH_FLAGS_AE 0x3 /* mask */
99
#define MESH_FLAGS_AE_A4 0x1
100
#define MESH_FLAGS_AE_A5_A6 0x2
101
102
/* Max number of paths */
103
#define RTW_MESH_MAX_PATHS 1024
104
105
#define RTW_PREQ_Q_F_START 0x1
106
#define RTW_PREQ_Q_F_REFRESH 0x2
107
#define RTW_PREQ_Q_F_CHK 0x4
108
#define RTW_PREQ_Q_F_PEER_AKA 0x8
109
#define RTW_PREQ_Q_F_BCAST_PREQ 0x10 /* force path_dicover using broadcast */
110
struct rtw_mesh_preq_queue {
111
_list list;
112
u8 dst[ETH_ALEN];
113
u8 flags;
114
};
115
116
extern const u8 ae_to_mesh_ctrl_len[];
117
118
enum mesh_frame_type {
119
MESH_UCAST_DATA = 0x0,
120
MESH_BMCAST_DATA = 0x1,
121
MESH_UCAST_PX_DATA = 0x2,
122
MESH_BMCAST_PX_DATA = 0x3,
123
MESH_MHOP_UCAST_ACT = 0x4,
124
MESH_MHOP_BMCAST_ACT = 0x5,
125
};
126
127
enum mpath_sel_frame_type {
128
MPATH_PREQ = 0,
129
MPATH_PREP,
130
MPATH_PERR,
131
MPATH_RANN
132
};
133
134
/**
135
* enum rtw_mesh_deferred_task_flags - mesh deferred tasks
136
*
137
*
138
*
139
* @RTW_MESH_WORK_HOUSEKEEPING: run the periodic mesh housekeeping tasks
140
* @RTW_MESH_WORK_ROOT: the mesh root station needs to send a frame
141
* @RTW_MESH_WORK_DRIFT_ADJUST: time to compensate for clock drift relative to other
142
* mesh nodes
143
* @RTW_MESH_WORK_MBSS_CHANGED: rebuild beacon and notify driver of BSS changes
144
*/
145
enum rtw_mesh_deferred_task_flags {
146
RTW_MESH_WORK_HOUSEKEEPING,
147
RTW_MESH_WORK_ROOT,
148
RTW_MESH_WORK_DRIFT_ADJUST,
149
RTW_MESH_WORK_MBSS_CHANGED,
150
};
151
152
#define RTW_MESH_MAX_PEER_CANDIDATES 15 /* aid consideration */
153
#define RTW_MESH_MAX_PEER_LINKS 8
154
#define RTW_MESH_PEER_LINK_TIMEOUT 20
155
156
#define RTW_MESH_PEER_CONF_DISABLED 0 /* special time value means no confirmation ongoing */
157
#if CONFIG_RTW_MESH_PEER_BLACKLIST
158
#define IS_PEER_CONF_DISABLED(plink) ((plink)->peer_conf_end_time == RTW_MESH_PEER_CONF_DISABLED)
159
#define IS_PEER_CONF_TIMEOUT(plink)(!IS_PEER_CONF_DISABLED(plink) && rtw_time_after(rtw_get_current_time(), (plink)->peer_conf_end_time))
160
#define SET_PEER_CONF_DISABLED(plink) (plink)->peer_conf_end_time = RTW_MESH_PEER_CONF_DISABLED
161
#define SET_PEER_CONF_END_TIME(plink, timeout_ms) \
162
do { \
163
(plink)->peer_conf_end_time = rtw_get_current_time() + rtw_ms_to_systime(timeout_ms); \
164
if ((plink)->peer_conf_end_time == RTW_MESH_PEER_CONF_DISABLED) \
165
(plink)->peer_conf_end_time++; \
166
} while (0)
167
#else
168
#define IS_PEER_CONF_DISABLED(plink) 1
169
#define IS_PEER_CONF_TIMEOUT(plink) 0
170
#define SET_PEER_CONF_DISABLED(plink) do {} while (0)
171
#define SET_PEER_CONF_END_TIME(plink, timeout_ms) do {} while (0)
172
#endif /* CONFIG_RTW_MESH_PEER_BLACKLIST */
173
174
#define RTW_MESH_CTO_MGATE_CONF_DISABLED 0 /* special time value means no confirmation ongoing */
175
#if CONFIG_RTW_MESH_CTO_MGATE_BLACKLIST
176
#define IS_CTO_MGATE_CONF_DISABLED(plink) ((plink)->cto_mgate_conf_end_time == RTW_MESH_CTO_MGATE_CONF_DISABLED)
177
#define IS_CTO_MGATE_CONF_TIMEOUT(plink)(!IS_CTO_MGATE_CONF_DISABLED(plink) && rtw_time_after(rtw_get_current_time(), (plink)->cto_mgate_conf_end_time))
178
#define SET_CTO_MGATE_CONF_DISABLED(plink) (plink)->cto_mgate_conf_end_time = RTW_MESH_CTO_MGATE_CONF_DISABLED
179
#define SET_CTO_MGATE_CONF_END_TIME(plink, timeout_ms) \
180
do { \
181
(plink)->cto_mgate_conf_end_time = rtw_get_current_time() + rtw_ms_to_systime(timeout_ms); \
182
if ((plink)->cto_mgate_conf_end_time == RTW_MESH_CTO_MGATE_CONF_DISABLED) \
183
(plink)->cto_mgate_conf_end_time++; \
184
} while (0)
185
#else
186
#define IS_CTO_MGATE_CONF_DISABLED(plink) 1
187
#define IS_CTO_MGATE_CONF_TIMEOUT(plink) 0
188
#define SET_CTO_MGATE_CONF_DISABLED(plink) do {} while (0)
189
#define SET_CTO_MGATE_CONF_END_TIME(plink, timeout_ms) do {} while (0)
190
#endif /* CONFIG_RTW_MESH_CTO_MGATE_BLACKLIST */
191
192
struct mesh_plink_ent {
193
u8 valid;
194
u8 addr[ETH_ALEN];
195
u8 plink_state;
196
197
#ifdef CONFIG_RTW_MESH_AEK
198
u8 aek_valid;
199
u8 aek[32];
200
#endif
201
202
u16 llid;
203
u16 plid;
204
#ifndef CONFIG_RTW_MESH_DRIVER_AID
205
u16 aid; /* aid assigned from upper layer */
206
#endif
207
u16 peer_aid; /* aid assigned from peer */
208
209
u8 chosen_pmk[16];
210
211
#ifdef CONFIG_RTW_MESH_AEK
212
u8 sel_pcs[4];
213
u8 l_nonce[32];
214
u8 p_nonce[32];
215
#endif
216
217
#ifdef CONFIG_RTW_MESH_DRIVER_AID
218
u8 *tx_conf_ies;
219
u16 tx_conf_ies_len;
220
#endif
221
u8 *rx_conf_ies;
222
u16 rx_conf_ies_len;
223
224
struct wlan_network *scanned;
225
226
#if CONFIG_RTW_MESH_PEER_BLACKLIST
227
systime peer_conf_end_time;
228
#endif
229
#if CONFIG_RTW_MESH_CTO_MGATE_BLACKLIST
230
systime cto_mgate_conf_end_time;
231
#endif
232
};
233
234
#ifdef CONFIG_RTW_MESH_AEK
235
#define MESH_PLINK_AEK_VALID(ent) ent->aek_valid
236
#else
237
#define MESH_PLINK_AEK_VALID(ent) 0
238
#endif
239
240
struct mesh_plink_pool {
241
_lock lock;
242
u8 num; /* current ent being used */
243
struct mesh_plink_ent ent[RTW_MESH_MAX_PEER_CANDIDATES];
244
245
#if CONFIG_RTW_MESH_ACNODE_PREVENT
246
u8 acnode_rsvd;
247
#endif
248
249
#if CONFIG_RTW_MESH_PEER_BLACKLIST
250
_queue peer_blacklist;
251
#endif
252
#if CONFIG_RTW_MESH_CTO_MGATE_BLACKLIST
253
_queue cto_mgate_blacklist;
254
#endif
255
};
256
257
struct mesh_peer_sel_policy {
258
u32 scanr_exp_ms;
259
260
#if CONFIG_RTW_MESH_ACNODE_PREVENT
261
u8 acnode_prevent;
262
u32 acnode_conf_timeout_ms;
263
u32 acnode_notify_timeout_ms;
264
#endif
265
266
#if CONFIG_RTW_MESH_OFFCH_CAND
267
u8 offch_cand;
268
u32 offch_find_int_ms; /* 0 means no offch find triggerred by driver self*/
269
#endif
270
271
#if CONFIG_RTW_MESH_PEER_BLACKLIST
272
u32 peer_conf_timeout_ms;
273
u32 peer_blacklist_timeout_ms;
274
#endif
275
276
#if CONFIG_RTW_MESH_CTO_MGATE_BLACKLIST
277
u8 cto_mgate_require;
278
u32 cto_mgate_conf_timeout_ms;
279
u32 cto_mgate_blacklist_timeout_ms;
280
#endif
281
};
282
283
/* b2u flags */
284
#define RTW_MESH_B2U_ALL BIT0
285
#define RTW_MESH_B2U_GA_UCAST BIT1 /* Group addressed unicast frame, forward only */
286
#define RTW_MESH_B2U_BCAST BIT2
287
#define RTW_MESH_B2U_IP_MCAST BIT3
288
289
#define rtw_msrc_b2u_policy_chk(flags, mda) ( \
290
(flags & RTW_MESH_B2U_ALL) \
291
|| ((flags & RTW_MESH_B2U_BCAST) && is_broadcast_mac_addr(mda)) \
292
|| ((flags & RTW_MESH_B2U_IP_MCAST) && (IP_MCAST_MAC(mda) || ICMPV6_MCAST_MAC(mda))) \
293
)
294
295
#define rtw_mfwd_b2u_policy_chk(flags, mda, ucst) ( \
296
(flags & RTW_MESH_B2U_ALL) \
297
|| ((flags & RTW_MESH_B2U_GA_UCAST) && ucst) \
298
|| ((flags & RTW_MESH_B2U_BCAST) && is_broadcast_mac_addr(mda)) \
299
|| ((flags & RTW_MESH_B2U_IP_MCAST) && (IP_MCAST_MAC(mda) || ICMPV6_MCAST_MAC(mda))) \
300
)
301
302
/**
303
* @sane_metric_delta: Controlling if trigger additional path check mechanism
304
* @max_root_add_chk_cnt: The retry cnt to send additional root confirmation
305
* PREQ through old(last) path
306
*/
307
struct rtw_mesh_cfg {
308
u8 max_peer_links; /* peering limit */
309
u32 plink_timeout; /* seconds */
310
311
u8 dot11MeshTTL;
312
u8 element_ttl;
313
u32 path_refresh_time;
314
u16 dot11MeshHWMPpreqMinInterval;
315
u16 dot11MeshHWMPnetDiameterTraversalTime;
316
u32 dot11MeshHWMPactivePathTimeout;
317
u8 dot11MeshHWMPmaxPREQretries;
318
u16 min_discovery_timeout;
319
u16 dot11MeshHWMPconfirmationInterval;
320
u16 dot11MeshHWMPperrMinInterval;
321
u8 dot11MeshHWMPRootMode;
322
BOOLEAN dot11MeshForwarding;
323
s32 rssi_threshold; /* in dBm, 0: no specified */
324
u16 dot11MeshHWMPRannInterval;
325
BOOLEAN dot11MeshGateAnnouncementProtocol;
326
u32 dot11MeshHWMPactivePathToRootTimeout;
327
u16 dot11MeshHWMProotInterval;
328
u8 path_gate_timeout_factor;
329
#ifdef CONFIG_RTW_MESH_ADD_ROOT_CHK
330
u16 sane_metric_delta;
331
u8 max_root_add_chk_cnt;
332
#endif
333
334
struct mesh_peer_sel_policy peer_sel_policy;
335
336
#if CONFIG_RTW_MESH_DATA_BMC_TO_UC
337
u8 b2u_flags_msrc;
338
u8 b2u_flags_mfwd;
339
#endif
340
};
341
342
struct rtw_mesh_stats {
343
u32 fwded_mcast; /* Mesh forwarded multicast frames */
344
u32 fwded_unicast; /* Mesh forwarded unicast frames */
345
u32 fwded_frames; /* Mesh total forwarded frames */
346
u32 dropped_frames_ttl; /* Not transmitted since mesh_ttl == 0*/
347
u32 dropped_frames_no_route; /* Not transmitted, no route found */
348
u32 dropped_frames_congestion;/* Not forwarded due to congestion */
349
u32 dropped_frames_duplicate;
350
351
u32 mrc_del_qlen; /* MRC entry deleted cause by queue length limit */
352
};
353
354
struct rtw_mrc;
355
356
struct rtw_mesh_info {
357
u8 mesh_id[NDIS_802_11_LENGTH_SSID];
358
size_t mesh_id_len;
359
/* Active Path Selection Protocol Identifier */
360
u8 mesh_pp_id;
361
/* Active Path Selection Metric Identifier */
362
u8 mesh_pm_id;
363
/* Congestion Control Mode Identifier */
364
u8 mesh_cc_id;
365
/* Synchronization Protocol Identifier */
366
u8 mesh_sp_id;
367
/* Authentication Protocol Identifier */
368
u8 mesh_auth_id;
369
370
struct mesh_plink_pool plink_ctl;
371
372
u32 mesh_seqnum;
373
/* MSTA's own hwmp sequence number */
374
u32 sn;
375
systime last_preq;
376
systime last_sn_update;
377
systime next_perr;
378
/* Last used Path Discovery ID */
379
u32 preq_id;
380
381
ATOMIC_T mpaths;
382
struct rtw_mesh_table *mesh_paths;
383
struct rtw_mesh_table *mpp_paths;
384
int mesh_paths_generation;
385
int mpp_paths_generation;
386
387
int num_gates;
388
struct rtw_mesh_path *max_addr_gate;
389
bool max_addr_gate_is_larger_than_self;
390
391
struct rtw_mesh_stats mshstats;
392
393
_queue mpath_tx_queue;
394
u32 mpath_tx_queue_len;
395
_tasklet mpath_tx_tasklet;
396
397
struct rtw_mrc *mrc;
398
399
_lock mesh_preq_queue_lock;
400
struct rtw_mesh_preq_queue preq_queue;
401
int preq_queue_len;
402
};
403
404
extern const char *_action_self_protected_str[];
405
#define action_self_protected_str(action) ((action < RTW_ACT_SELF_PROTECTED_NUM) ? _action_self_protected_str[action] : _action_self_protected_str[0])
406
407
u8 *rtw_set_ie_mesh_id(u8 *buf, u32 *buf_len, const char *mesh_id, u8 id_len);
408
u8 *rtw_set_ie_mesh_config(u8 *buf, u32 *buf_len
409
, u8 path_sel_proto, u8 path_sel_metric, u8 congest_ctl_mode, u8 sync_method, u8 auth_proto
410
, u8 num_of_peerings, bool cto_mgate, bool cto_as
411
, bool accept_peerings, bool mcca_sup, bool mcca_en, bool forwarding
412
, bool mbca_en, bool tbtt_adj, bool ps_level);
413
414
int rtw_bss_is_same_mbss(WLAN_BSSID_EX *a, WLAN_BSSID_EX *b);
415
int rtw_bss_is_candidate_mesh_peer(WLAN_BSSID_EX *self, WLAN_BSSID_EX *target, u8 ch, u8 add_peer);
416
417
void rtw_chk_candidate_peer_notify(_adapter *adapter, struct wlan_network *scanned);
418
419
void rtw_mesh_peer_status_chk(_adapter *adapter);
420
421
#if CONFIG_RTW_MESH_ACNODE_PREVENT
422
void rtw_mesh_update_scanned_acnode_status(_adapter *adapter, struct wlan_network *scanned);
423
bool rtw_mesh_scanned_is_acnode_confirmed(_adapter *adapter, struct wlan_network *scanned);
424
bool rtw_mesh_acnode_prevent_allow_sacrifice(_adapter *adapter);
425
struct sta_info *rtw_mesh_acnode_prevent_pick_sacrifice(_adapter *adapter);
426
void dump_mesh_acnode_prevent_settings(void *sel, _adapter *adapter);
427
#endif
428
429
#if CONFIG_RTW_MESH_OFFCH_CAND
430
u8 rtw_mesh_offch_candidate_accepted(_adapter *adapter);
431
u8 rtw_mesh_select_operating_ch(_adapter *adapter);
432
void dump_mesh_offch_cand_settings(void *sel, _adapter *adapter);
433
#endif
434
435
#if CONFIG_RTW_MESH_PEER_BLACKLIST
436
int rtw_mesh_peer_blacklist_add(_adapter *adapter, const u8 *addr);
437
int rtw_mesh_peer_blacklist_del(_adapter *adapter, const u8 *addr);
438
int rtw_mesh_peer_blacklist_search(_adapter *adapter, const u8 *addr);
439
void rtw_mesh_peer_blacklist_flush(_adapter *adapter);
440
void dump_mesh_peer_blacklist(void *sel, _adapter *adapter);
441
void dump_mesh_peer_blacklist_settings(void *sel, _adapter *adapter);
442
#endif
443
#if CONFIG_RTW_MESH_CTO_MGATE_BLACKLIST
444
u8 rtw_mesh_cto_mgate_required(_adapter *adapter);
445
u8 rtw_mesh_cto_mgate_network_filter(_adapter *adapter, struct wlan_network *scanned);
446
int rtw_mesh_cto_mgate_blacklist_add(_adapter *adapter, const u8 *addr);
447
int rtw_mesh_cto_mgate_blacklist_del(_adapter *adapter, const u8 *addr);
448
int rtw_mesh_cto_mgate_blacklist_search(_adapter *adapter, const u8 *addr);
449
void rtw_mesh_cto_mgate_blacklist_flush(_adapter *adapter);
450
void dump_mesh_cto_mgate_blacklist(void *sel, _adapter *adapter);
451
void dump_mesh_cto_mgate_blacklist_settings(void *sel, _adapter *adapter);
452
#endif
453
void dump_mesh_peer_sel_policy(void *sel, _adapter *adapter);
454
void dump_mesh_networks(void *sel, _adapter *adapter);
455
456
void rtw_mesh_adjust_chbw(u8 req_ch, u8 *req_bw, u8 *req_offset);
457
458
void rtw_mesh_sae_check_frames(_adapter *adapter, const u8 *buf, u32 len, u8 tx, u16 alg, u16 seq, u16 status);
459
int rtw_mesh_check_frames_tx(_adapter *adapter, const u8 **buf, size_t *len);
460
int rtw_mesh_check_frames_rx(_adapter *adapter, const u8 *buf, size_t len);
461
462
int rtw_mesh_on_auth(_adapter *adapter, union recv_frame *rframe);
463
unsigned int on_action_self_protected(_adapter *adapter, union recv_frame *rframe);
464
465
bool rtw_mesh_update_bss_peering_status(_adapter *adapter, WLAN_BSSID_EX *bss);
466
bool rtw_mesh_update_bss_formation_info(_adapter *adapter, WLAN_BSSID_EX *bss);
467
bool rtw_mesh_update_bss_forwarding_state(_adapter *adapter, WLAN_BSSID_EX *bss);
468
469
struct mesh_plink_ent *_rtw_mesh_plink_get(_adapter *adapter, const u8 *hwaddr);
470
struct mesh_plink_ent *rtw_mesh_plink_get(_adapter *adapter, const u8 *hwaddr);
471
struct mesh_plink_ent *rtw_mesh_plink_get_no_estab_by_idx(_adapter *adapter, u8 idx);
472
int _rtw_mesh_plink_add(_adapter *adapter, const u8 *hwaddr);
473
int rtw_mesh_plink_add(_adapter *adapter, const u8 *hwaddr);
474
int rtw_mesh_plink_set_state(_adapter *adapter, const u8 *hwaddr, u8 state);
475
#ifdef CONFIG_RTW_MESH_AEK
476
int rtw_mesh_plink_set_aek(_adapter *adapter, const u8 *hwaddr, const u8 *aek);
477
#endif
478
#if CONFIG_RTW_MESH_PEER_BLACKLIST
479
int rtw_mesh_plink_set_peer_conf_timeout(_adapter *adapter, const u8 *hwaddr);
480
#endif
481
void _rtw_mesh_plink_del_ent(_adapter *adapter, struct mesh_plink_ent *ent);
482
int rtw_mesh_plink_del(_adapter *adapter, const u8 *hwaddr);
483
void rtw_mesh_plink_ctl_init(_adapter *adapter);
484
void rtw_mesh_plink_ctl_deinit(_adapter *adapter);
485
void dump_mesh_plink_ctl(void *sel, _adapter *adapter);
486
487
int rtw_mesh_peer_establish(_adapter *adapter, struct mesh_plink_ent *plink, struct sta_info *sta);
488
void _rtw_mesh_expire_peer_ent(_adapter *adapter, struct mesh_plink_ent *plink);
489
void rtw_mesh_expire_peer(_adapter *adapter, const u8 *peer_addr);
490
u8 rtw_mesh_ps_annc(_adapter *adapter, u8 ps);
491
492
unsigned int on_action_mesh(_adapter *adapter, union recv_frame *rframe);
493
494
void rtw_mesh_cfg_init(_adapter *adapter);
495
void rtw_mesh_cfg_init_max_peer_links(_adapter *adapter, u8 stack_conf);
496
void rtw_mesh_cfg_init_plink_timeout(_adapter *adapter, u32 stack_conf);
497
void rtw_mesh_init_mesh_info(_adapter *adapter);
498
void rtw_mesh_deinit_mesh_info(_adapter *adapter);
499
500
#if CONFIG_RTW_MESH_DATA_BMC_TO_UC
501
void dump_mesh_b2u_flags(void *sel, _adapter *adapter);
502
#endif
503
504
int rtw_mesh_addr_resolve(_adapter *adapter, struct xmit_frame *xframe, _pkt *pkt, _list *b2u_list);
505
506
s8 rtw_mesh_tx_set_whdr_mctrl_len(u8 mesh_frame_mode, struct pkt_attrib *attrib);
507
void rtw_mesh_tx_build_mctrl(_adapter *adapter, struct pkt_attrib *attrib, u8 *buf);
508
u8 rtw_mesh_tx_build_whdr(_adapter *adapter, struct pkt_attrib *attrib
509
, u16 *fctrl, struct rtw_ieee80211_hdr *whdr);
510
511
int rtw_mesh_rx_data_validate_hdr(_adapter *adapter, union recv_frame *rframe, struct sta_info **sta);
512
int rtw_mesh_rx_data_validate_mctrl(_adapter *adapter, union recv_frame *rframe
513
, const struct rtw_ieee80211s_hdr *mctrl, const u8 *mda, const u8 *msa
514
, u8 *mctrl_len, const u8 **da, const u8 **sa);
515
int rtw_mesh_rx_validate_mctrl_non_amsdu(_adapter *adapter, union recv_frame *rframe);
516
517
int rtw_mesh_rx_msdu_act_check(union recv_frame *rframe
518
, const u8 *mda, const u8 *msa
519
, const u8 *da, const u8 *sa
520
, struct rtw_ieee80211s_hdr *mctrl
521
, struct xmit_frame **fwd_frame, _list *b2u_list);
522
523
void dump_mesh_stats(void *sel, _adapter *adapter);
524
525
#if defined(PLATFORM_LINUX) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 32))
526
#define rtw_lockdep_assert_held(l) lockdep_assert_held(l)
527
#define rtw_lockdep_is_held(l) lockdep_is_held(l)
528
#else
529
#error "TBD\n"
530
#endif
531
532
#include "rtw_mesh_pathtbl.h"
533
#include "rtw_mesh_hwmp.h"
534
#endif /* __RTW_MESH_H_ */
535
536
537