Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * IEEE 802.11 mesh definitions
4 *
5 * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen
6 * <jkmaline@cc.hut.fi>
7 * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi>
8 * Copyright (c) 2005, Devicescape Software, Inc.
9 * Copyright (c) 2006, Michael Wu <flamingice@sourmilk.net>
10 * Copyright (c) 2013 - 2014 Intel Mobile Communications GmbH
11 * Copyright (c) 2016 - 2017 Intel Deutschland GmbH
12 * Copyright (c) 2018 - 2025 Intel Corporation
13 */
14
15#ifndef LINUX_IEEE80211_MESH_H
16#define LINUX_IEEE80211_MESH_H
17
18#include <linux/types.h>
19#include <linux/if_ether.h>
20
21#define IEEE80211_MAX_MESH_ID_LEN 32
22
23struct ieee80211s_hdr {
24 u8 flags;
25 u8 ttl;
26 __le32 seqnum;
27 u8 eaddr1[ETH_ALEN];
28 u8 eaddr2[ETH_ALEN];
29} __packed __aligned(2);
30
31/* Mesh flags */
32#define MESH_FLAGS_AE_A4 0x1
33#define MESH_FLAGS_AE_A5_A6 0x2
34#define MESH_FLAGS_AE 0x3
35#define MESH_FLAGS_PS_DEEP 0x4
36
37/**
38 * enum ieee80211_preq_flags - mesh PREQ element flags
39 *
40 * @IEEE80211_PREQ_PROACTIVE_PREP_FLAG: proactive PREP subfield
41 */
42enum ieee80211_preq_flags {
43 IEEE80211_PREQ_PROACTIVE_PREP_FLAG = 1<<2,
44};
45
46/**
47 * enum ieee80211_preq_target_flags - mesh PREQ element per target flags
48 *
49 * @IEEE80211_PREQ_TO_FLAG: target only subfield
50 * @IEEE80211_PREQ_USN_FLAG: unknown target HWMP sequence number subfield
51 */
52enum ieee80211_preq_target_flags {
53 IEEE80211_PREQ_TO_FLAG = 1<<0,
54 IEEE80211_PREQ_USN_FLAG = 1<<2,
55};
56
57/**
58 * struct ieee80211_mesh_chansw_params_ie - mesh channel switch parameters IE
59 * @mesh_ttl: Time To Live
60 * @mesh_flags: Flags
61 * @mesh_reason: Reason Code
62 * @mesh_pre_value: Precedence Value
63 *
64 * This structure represents the payload of the "Mesh Channel Switch
65 * Parameters element" as described in IEEE Std 802.11-2020 section
66 * 9.4.2.102.
67 */
68struct ieee80211_mesh_chansw_params_ie {
69 u8 mesh_ttl;
70 u8 mesh_flags;
71 __le16 mesh_reason;
72 __le16 mesh_pre_value;
73} __packed;
74
75/**
76 * struct ieee80211_meshconf_ie - Mesh Configuration element
77 * @meshconf_psel: Active Path Selection Protocol Identifier
78 * @meshconf_pmetric: Active Path Selection Metric Identifier
79 * @meshconf_congest: Congestion Control Mode Identifier
80 * @meshconf_synch: Synchronization Method Identifier
81 * @meshconf_auth: Authentication Protocol Identifier
82 * @meshconf_form: Mesh Formation Info
83 * @meshconf_cap: Mesh Capability (see &enum mesh_config_capab_flags)
84 *
85 * This structure represents the payload of the "Mesh Configuration
86 * element" as described in IEEE Std 802.11-2020 section 9.4.2.97.
87 */
88struct ieee80211_meshconf_ie {
89 u8 meshconf_psel;
90 u8 meshconf_pmetric;
91 u8 meshconf_congest;
92 u8 meshconf_synch;
93 u8 meshconf_auth;
94 u8 meshconf_form;
95 u8 meshconf_cap;
96} __packed;
97
98/**
99 * enum mesh_config_capab_flags - Mesh Configuration IE capability field flags
100 *
101 * @IEEE80211_MESHCONF_CAPAB_ACCEPT_PLINKS: STA is willing to establish
102 * additional mesh peerings with other mesh STAs
103 * @IEEE80211_MESHCONF_CAPAB_FORWARDING: the STA forwards MSDUs
104 * @IEEE80211_MESHCONF_CAPAB_TBTT_ADJUSTING: TBTT adjustment procedure
105 * is ongoing
106 * @IEEE80211_MESHCONF_CAPAB_POWER_SAVE_LEVEL: STA is in deep sleep mode or has
107 * neighbors in deep sleep mode
108 *
109 * Enumerates the "Mesh Capability" as described in IEEE Std
110 * 802.11-2020 section 9.4.2.97.7.
111 */
112enum mesh_config_capab_flags {
113 IEEE80211_MESHCONF_CAPAB_ACCEPT_PLINKS = 0x01,
114 IEEE80211_MESHCONF_CAPAB_FORWARDING = 0x08,
115 IEEE80211_MESHCONF_CAPAB_TBTT_ADJUSTING = 0x20,
116 IEEE80211_MESHCONF_CAPAB_POWER_SAVE_LEVEL = 0x40,
117};
118
119#define IEEE80211_MESHCONF_FORM_CONNECTED_TO_GATE 0x1
120
121/*
122 * mesh channel switch parameters element's flag indicator
123 *
124 */
125#define WLAN_EID_CHAN_SWITCH_PARAM_TX_RESTRICT BIT(0)
126#define WLAN_EID_CHAN_SWITCH_PARAM_INITIATOR BIT(1)
127#define WLAN_EID_CHAN_SWITCH_PARAM_REASON BIT(2)
128
129/**
130 * struct ieee80211_rann_ie - RANN (root announcement) element
131 * @rann_flags: Flags
132 * @rann_hopcount: Hop Count
133 * @rann_ttl: Element TTL
134 * @rann_addr: Root Mesh STA Address
135 * @rann_seq: HWMP Sequence Number
136 * @rann_interval: Interval
137 * @rann_metric: Metric
138 *
139 * This structure represents the payload of the "RANN element" as
140 * described in IEEE Std 802.11-2020 section 9.4.2.111.
141 */
142struct ieee80211_rann_ie {
143 u8 rann_flags;
144 u8 rann_hopcount;
145 u8 rann_ttl;
146 u8 rann_addr[ETH_ALEN];
147 __le32 rann_seq;
148 __le32 rann_interval;
149 __le32 rann_metric;
150} __packed;
151
152enum ieee80211_rann_flags {
153 RANN_FLAG_IS_GATE = 1 << 0,
154};
155
156/* Mesh action codes */
157enum ieee80211_mesh_actioncode {
158 WLAN_MESH_ACTION_LINK_METRIC_REPORT,
159 WLAN_MESH_ACTION_HWMP_PATH_SELECTION,
160 WLAN_MESH_ACTION_GATE_ANNOUNCEMENT,
161 WLAN_MESH_ACTION_CONGESTION_CONTROL_NOTIFICATION,
162 WLAN_MESH_ACTION_MCCA_SETUP_REQUEST,
163 WLAN_MESH_ACTION_MCCA_SETUP_REPLY,
164 WLAN_MESH_ACTION_MCCA_ADVERTISEMENT_REQUEST,
165 WLAN_MESH_ACTION_MCCA_ADVERTISEMENT,
166 WLAN_MESH_ACTION_MCCA_TEARDOWN,
167 WLAN_MESH_ACTION_TBTT_ADJUSTMENT_REQUEST,
168 WLAN_MESH_ACTION_TBTT_ADJUSTMENT_RESPONSE,
169};
170
171/**
172 * enum ieee80211_mesh_sync_method - mesh synchronization method identifier
173 *
174 * @IEEE80211_SYNC_METHOD_NEIGHBOR_OFFSET: the default synchronization method
175 * @IEEE80211_SYNC_METHOD_VENDOR: a vendor specific synchronization method
176 * that will be specified in a vendor specific information element
177 */
178enum ieee80211_mesh_sync_method {
179 IEEE80211_SYNC_METHOD_NEIGHBOR_OFFSET = 1,
180 IEEE80211_SYNC_METHOD_VENDOR = 255,
181};
182
183/**
184 * enum ieee80211_mesh_path_protocol - mesh path selection protocol identifier
185 *
186 * @IEEE80211_PATH_PROTOCOL_HWMP: the default path selection protocol
187 * @IEEE80211_PATH_PROTOCOL_VENDOR: a vendor specific protocol that will
188 * be specified in a vendor specific information element
189 */
190enum ieee80211_mesh_path_protocol {
191 IEEE80211_PATH_PROTOCOL_HWMP = 1,
192 IEEE80211_PATH_PROTOCOL_VENDOR = 255,
193};
194
195/**
196 * enum ieee80211_mesh_path_metric - mesh path selection metric identifier
197 *
198 * @IEEE80211_PATH_METRIC_AIRTIME: the default path selection metric
199 * @IEEE80211_PATH_METRIC_VENDOR: a vendor specific metric that will be
200 * specified in a vendor specific information element
201 */
202enum ieee80211_mesh_path_metric {
203 IEEE80211_PATH_METRIC_AIRTIME = 1,
204 IEEE80211_PATH_METRIC_VENDOR = 255,
205};
206
207/**
208 * enum ieee80211_root_mode_identifier - root mesh STA mode identifier
209 *
210 * These attribute are used by dot11MeshHWMPRootMode to set root mesh STA mode
211 *
212 * @IEEE80211_ROOTMODE_NO_ROOT: the mesh STA is not a root mesh STA (default)
213 * @IEEE80211_ROOTMODE_ROOT: the mesh STA is a root mesh STA if greater than
214 * this value
215 * @IEEE80211_PROACTIVE_PREQ_NO_PREP: the mesh STA is a root mesh STA supports
216 * the proactive PREQ with proactive PREP subfield set to 0
217 * @IEEE80211_PROACTIVE_PREQ_WITH_PREP: the mesh STA is a root mesh STA
218 * supports the proactive PREQ with proactive PREP subfield set to 1
219 * @IEEE80211_PROACTIVE_RANN: the mesh STA is a root mesh STA supports
220 * the proactive RANN
221 */
222enum ieee80211_root_mode_identifier {
223 IEEE80211_ROOTMODE_NO_ROOT = 0,
224 IEEE80211_ROOTMODE_ROOT = 1,
225 IEEE80211_PROACTIVE_PREQ_NO_PREP = 2,
226 IEEE80211_PROACTIVE_PREQ_WITH_PREP = 3,
227 IEEE80211_PROACTIVE_RANN = 4,
228};
229
230#endif /* LINUX_IEEE80211_MESH_H */