1 /* 2 * Fundamental types and constants relating to 802.11s Mesh 3 * 4 * Copyright (C) 1999-2017, Broadcom Corporation 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 of 16 * the license of that module. An independent module is a module which is not 17 * 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 133 /* Mesh PREP IE */ 134 BWL_PRE_PACKED_STRUCT struct mesh_prep_ie { 135 uint8 id; 136 uint8 len; 137 uint8 flags; 138 uint8 hop_count; 139 uint8 ttl; 140 struct ether_addr target_addr; 141 uint32 target_seq; 142 union { 143 BWL_PRE_PACKED_STRUCT struct { 144 struct ether_addr target_ext_add; 145 uint32 lifetime; 146 uint32 metric; 147 uint8 target_count; 148 struct ether_addr originator_addr; 149 uint32 originator_seq; 150 } BWL_POST_PACKED_STRUCT oea; 151 152 BWL_PRE_PACKED_STRUCT struct { 153 uint32 lifetime; 154 uint32 metric; 155 uint8 target_count; 156 struct ether_addr originator_addr; 157 uint32 originator_seq; 158 } BWL_POST_PACKED_STRUCT noea; 159 } u; 160 } BWL_POST_PACKED_STRUCT; 161 typedef struct mesh_prep_ie mesh_prep_ie_t; 162 163 164 /* Mesh PERR IE */ 165 struct mesh_perr_ie { 166 uint8 id; 167 uint8 len; 168 uint8 ttl; 169 uint8 num_dest; 170 uint8 data[]; 171 }; 172 typedef struct mesh_perr_ie mesh_perr_ie_t; 173 174 /* Destination info is part of PERR IE */ 175 BWL_PRE_PACKED_STRUCT struct mesh_perr_destinfo { 176 uint8 flags; 177 struct ether_addr destination_addr; 178 uint32 dest_seq; 179 union { 180 BWL_PRE_PACKED_STRUCT struct { 181 struct ether_addr dest_ext_addr; 182 } BWL_POST_PACKED_STRUCT dea; 183 184 BWL_PRE_PACKED_STRUCT struct { 185 /* 1 byte reason code to be populated manually in software */ 186 uint16 reason_code; 187 } BWL_POST_PACKED_STRUCT nodea; 188 } u; 189 } BWL_POST_PACKED_STRUCT; 190 typedef struct mesh_perr_destinfo mesh_perr_destinfo_t; 191 192 /* Mesh peering action frame hdr */ 193 BWL_PRE_PACKED_STRUCT struct mesh_peering_frmhdr { 194 uint8 category; 195 uint8 action; 196 union { 197 struct { 198 uint16 capability; 199 } open; 200 struct { 201 uint16 capability; 202 uint16 AID; 203 } confirm; 204 uint8 data[1]; 205 } u; 206 } BWL_POST_PACKED_STRUCT; 207 typedef struct mesh_peering_frmhdr mesh_peering_frmhdr_t; 208 209 /* Mesh peering mgmt IE */ 210 BWL_PRE_PACKED_STRUCT struct mesh_peer_mgmt_ie_common { 211 uint16 mesh_peer_prot_id; 212 uint16 local_link_id; 213 } BWL_POST_PACKED_STRUCT; 214 typedef struct mesh_peer_mgmt_ie_common mesh_peer_mgmt_ie_common_t; 215 #define MESH_PEER_MGMT_IE_OPEN_LEN (4) 216 217 BWL_PRE_PACKED_STRUCT struct mesh_peer_mgmt_ie_cfm { 218 mesh_peer_mgmt_ie_common_t common; 219 uint16 peer_link_id; 220 } BWL_POST_PACKED_STRUCT; 221 typedef struct mesh_peer_mgmt_ie_cfm mesh_peer_mgmt_ie_cfm_t; 222 #define MESH_PEER_MGMT_IE_CONF_LEN (6) 223 224 BWL_PRE_PACKED_STRUCT struct mesh_peer_mgmt_ie_close { 225 mesh_peer_mgmt_ie_common_t common; 226 /* uint16 peer_link_id; 227 * simplicity: not supported, TODO for future 228 */ 229 uint16 reason_code; 230 } BWL_POST_PACKED_STRUCT; 231 typedef struct mesh_peer_mgmt_ie_close mesh_peer_mgmt_ie_close_t; 232 #define MESH_PEER_MGMT_IE_CLOSE_LEN (6) 233 234 struct mesh_config_ie { 235 uint8 activ_path_sel_prot_id; 236 uint8 activ_path_sel_metric_id; 237 uint8 cong_ctl_mode_id; 238 uint8 sync_method_id; 239 uint8 auth_prot_id; 240 uint8 mesh_formation_info; 241 uint8 mesh_cap; 242 }; 243 typedef struct mesh_config_ie mesh_config_ie_t; 244 #define MESH_CONFIG_IE_LEN (7) 245 246 /* Mesh peering states */ 247 #define MESH_PEERING_IDLE 0 248 #define MESH_PEERING_OPEN_SNT 1 249 #define MESH_PEERING_CNF_RCVD 2 250 #define MESH_PEERING_OPEN_RCVD 3 251 #define MESH_PEERING_ESTAB 4 252 #define MESH_PEERING_HOLDING 5 253 #define MESH_PEERING_LAST_STATE 6 254 /* for debugging: mapping strings */ 255 #define MESH_PEERING_STATE_STRINGS \ 256 {"IDLE ", "OPNSNT", "CNFRCV", "OPNRCV", "ESTAB ", "HOLDNG"} 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 /* TODO: no mention in spec? possibly used in PS case. Note that aid generated 270 * from self to peer is stored in scb. 271 */ 272 uint8 state; 273 /* TODO: 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 (sizeof(mesh_peer_info_dump_t) - sizeof(mesh_peer_info_ext_t)) 297 298 #endif /* WLMESH */ 299 300 /* once an entry is added into mesh_peer_list, if peering is lost, it will 301 * get retried for peering, MAX_MESH_PEER_ENTRY_RETRIES times. after wards, it 302 * wont get retried and will be moved to MESH_PEER_ENTRY_STATE_TIMEDOUT state, 303 * until user adds it again explicitely, when its entry_state is changed 304 * to MESH_PEER_ENTRY_STATE_ACTIVE and tried again. 305 */ 306 #define MAX_MESH_SELF_PEER_ENTRY_RETRIES 3 307 #define MESH_SELF_PEER_ENTRY_STATE_ACTIVE 1 308 #define MESH_SELF_PEER_ENTRY_STATE_TIMEDOUT 2 309 310 /** Mesh Channel Switch Parameter IE data structure */ 311 BWL_PRE_PACKED_STRUCT struct dot11_mcsp_body { 312 uint8 ttl; /* remaining number of hops allowed for this element. */ 313 uint8 flags; /* attributes of this channel switch attempt */ 314 uint8 reason; /* reason for the mesh channel switch */ 315 uint16 precedence; /* random value in the range 0 to 65535 */ 316 } BWL_POST_PACKED_STRUCT; 317 318 #define DOT11_MCSP_TTL_DEFAULT 1 319 #define DOT11_MCSP_FLAG_TRANS_RESTRICT 0x1 /* no transmit except frames with mcsp */ 320 #define DOT11_MCSP_FLAG_INIT 0x2 /* initiates the channel switch attempt */ 321 #define DOT11_MCSP_FLAG_REASON 0x4 /* validity of reason code field */ 322 #define DOT11_MCSP_REASON_REGULATORY 0 /* meet regulatory requirements */ 323 #define DOT11_MCSP_REASON_UNSPECIFIED 1 /* unspecified reason */ 324 325 BWL_PRE_PACKED_STRUCT struct dot11_mesh_csp { 326 uint8 id; /* id DOT11_MNG_MESH_CSP_ID */ 327 uint8 len; /* length of IE */ 328 struct dot11_mcsp_body body; /* body of the ie */ 329 } BWL_POST_PACKED_STRUCT; 330 typedef struct dot11_mesh_csp dot11_mesh_csp_ie_t; 331 #define DOT11_MESH_CSP_IE_LEN 5 /* length of mesh channel switch parameter IE body */ 332 333 /* This marks the end of a packed structure section. */ 334 #include <packed_section_end.h> 335 336 #endif /* #ifndef _802_11s_H_ */ 337