1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Fundamental types and constants relating to WFA MBO 4 * (Multiband Operation) 5 * Copyright (C) 1999-2019, Broadcom. 6 * 7 * Unless you and Broadcom execute a separate written software license 8 * agreement governing use of this software, this software is licensed to you 9 * under the terms of the GNU General Public License version 2 (the "GPL"), 10 * available at http://www.broadcom.com/licenses/GPLv2.php, with the 11 * following added to such license: 12 * 13 * As a special exception, the copyright holders of this software give you 14 * permission to link this software with independent modules, and to copy and 15 * distribute the resulting executable under terms of your choice, provided that 16 * you also meet, for each linked independent module, the terms and conditions of 17 * the license of that module. An independent module is a module which is not 18 * derived from this software. The special exception does not apply to any 19 * modifications of the software. 20 * 21 * Notwithstanding the above, under no circumstances may you combine this 22 * software in any way with any other Broadcom software provided under a license 23 * other than the GPL, without Broadcom's express prior written consent. 24 * 25 * 26 * <<Broadcom-WL-IPTag/Open:>> 27 * 28 * $Id$ 29 */ 30 31 #ifndef _MBO_H_ 32 #define _MBO_H_ 33 34 /* This marks the start of a packed structure section. */ 35 #include <packed_section_start.h> 36 37 /* WiFi MBO OUI values */ 38 #define MBO_OUI WFA_OUI /* WiFi OUI 50:6F:9A */ 39 /* oui_type field identifying the type and version of the MBO IE. */ 40 #define MBO_OUI_TYPE WFA_OUI_TYPE_MBO /* OUI Type/Version */ 41 /* IEEE 802.11 vendor specific information element. */ 42 #define MBO_IE_ID 0xdd 43 44 /* MBO ATTR related macros */ 45 #define MBO_ATTR_ID_OFF 0 46 #define MBO_ATTR_LEN_OFF 1 47 #define MBO_ATTR_DATA_OFF 2 48 49 #define MBO_ATTR_ID_LEN 1 /* Attr ID field length */ 50 #define MBO_ATTR_LEN_LEN 1 /* Attr Length field length */ 51 #define MBO_ATTR_HDR_LEN 2 /* ID + 1-byte length field */ 52 53 /* MBO subelemts related */ 54 #define MBO_SUBELEM_ID 0xdd 55 #define MBO_SUBELEM_OUI WFA_OUI 56 57 #define MBO_SUBELEM_ID_LEN 1 /* SubElement ID field length */ 58 #define MBO_SUBELEM_LEN_LEN 1 /* SubElement length field length */ 59 #define MBO_SUBELEM_HDR_LEN 6 /* ID + length + OUI + OUY TYPE */ 60 61 #define MBO_NON_PREF_CHAN_SUBELEM_LEN_LEN(L) (7 + (L)) /* value of length field */ 62 #define MBO_NON_PREF_CHAN_SUBELEM_TOT_LEN(L) \ 63 (MBO_SUBELEM_ID_LEN + MBO_SUBELEM_LEN_LEN + MBO_NON_PREF_CHAN_SUBELEM_LEN_LEN(L)) 64 /* MBO attributes as defined in the mbo spec */ 65 enum { 66 MBO_ATTR_MBO_AP_CAPABILITY = 1, 67 MBO_ATTR_NON_PREF_CHAN_REPORT = 2, 68 MBO_ATTR_CELL_DATA_CAP = 3, 69 MBO_ATTR_ASSOC_DISALLOWED = 4, 70 MBO_ATTR_CELL_DATA_CONN_PREF = 5, 71 MBO_ATTR_TRANS_REASON_CODE = 6, 72 MBO_ATTR_TRANS_REJ_REASON_CODE = 7, 73 MBO_ATTR_ASSOC_RETRY_DELAY = 8 74 }; 75 76 typedef BWL_PRE_PACKED_STRUCT struct wifi_mbo_ie_s { 77 uint8 id; /* IE ID: MBO_IE_ID 0xDD */ 78 uint8 len; /* IE length */ 79 uint8 oui[WFA_OUI_LEN]; /* MBO_OUI 50:6F:9A */ 80 uint8 oui_type; /* MBO_OUI_TYPE 0x16 */ 81 uint8 attr[1]; /* var len attributes */ 82 } BWL_POST_PACKED_STRUCT wifi_mbo_ie_t; 83 84 #define MBO_IE_HDR_SIZE (OFFSETOF(wifi_mbo_ie_t, attr)) 85 /* oui:3 bytes + oui type:1 byte */ 86 #define MBO_IE_NO_ATTR_LEN 4 87 88 /* MBO AP Capability Attribute */ 89 typedef BWL_PRE_PACKED_STRUCT struct wifi_mbo_ap_cap_ind_attr_s { 90 /* Attribute ID - 0x01. */ 91 uint8 id; 92 /* Length of the following fields in the attribute */ 93 uint8 len; 94 /* AP capability bitmap */ 95 uint8 cap_ind; 96 } BWL_POST_PACKED_STRUCT wifi_mbo_ap_cap_ind_attr_t; 97 98 /* MBO AP Capability Indication Field Values */ 99 #define MBO_AP_CAP_IND_CELLULAR_AWARE 0x40 100 101 /* Non-preferred Channel Report Attribute */ 102 #define MBO_NON_PREF_CHAN_ATTR_OPCALSS_OFF 2 103 #define MBO_NON_PREF_CHAN_ATTR_CHANLIST_OFF 3 104 #define MBO_NON_PREF_CHAN_ATTR_PREF_OFF(L) \ 105 (MBO_NON_PREF_CHAN_ATTR_CHANLIST_OFF + (L)) 106 107 #define MBO_NON_PREF_CHAN_ATTR_OPCALSS_LEN 1 108 #define MBO_NON_PREF_CHAN_ATTR_PREF_LEN 1 109 #define MBO_NON_PREF_CHAN_ATTR_REASON_LEN 1 110 111 #define MBO_NON_PREF_CHAN_ATTR_LEN(L) ((L) + 3) 112 #define MBO_NON_PREF_CHAN_ATTR_TOT_LEN(L) (MBO_ATTR_HDR_LEN + (L) + 3) 113 114 /* attribute len - (opclass + Pref + Reason) */ 115 #define MBO_NON_PREF_CHAN_ATTR_CHANLIST_LEN(L) ((L) - 3) 116 117 /* MBO Non-preferred Channel Report: "Preference" field value */ 118 enum { 119 MBO_STA_NON_OPERABLE_BAND_CHAN = 0, 120 MBO_STA_NON_PREFERRED_BAND_CHAN = 1, 121 MBO_STA_PREFERRED_BAND_CHAN = 255 122 }; 123 124 /* MBO Non-preferred Channel Report: "Reason Code" field value */ 125 enum { 126 MBO_NON_PREF_CHAN_RC_UNSPECIFIED = 0, 127 MBO_NON_PREF_CHAN_RC_BCN_STRENGTH = 1, 128 MBO_NON_PREF_CHAN_RC_CO_LOC_INTERFERENCE = 2, 129 MBO_NON_PREF_CHAN_RC_IN_DEV_INTERFERENCE = 3 130 }; 131 132 /* Cellular Data Capability Attribute */ 133 typedef BWL_PRE_PACKED_STRUCT struct wifi_mbo_cell_data_cap_attr_s { 134 /* Attribute ID - 0x03. */ 135 uint8 id; 136 /* Length of the following fields in the attribute */ 137 uint8 len; 138 /* MBO STA's cellular capability */ 139 uint8 cell_conn; 140 } BWL_POST_PACKED_STRUCT wifi_mbo_cell_data_cap_attr_t; 141 142 /* MBO Cellular Data Capability: "Cellular Connectivity" field value */ 143 enum { 144 MBO_CELL_DATA_CONN_AVAILABLE = 1, 145 MBO_CELL_DATA_CONN_NOT_AVAILABLE = 2, 146 MBO_CELL_DATA_CONN_NOT_CAPABLE = 3 147 }; 148 149 /* Association Disallowed attribute */ 150 typedef BWL_PRE_PACKED_STRUCT struct wifi_mbo_assoc_disallowed_attr_s { 151 /* Attribute ID - 0x04. */ 152 uint8 id; 153 /* Length of the following fields in the attribute */ 154 uint8 len; 155 /* Reason of not accepting new association */ 156 uint8 reason_code; 157 } BWL_POST_PACKED_STRUCT wifi_mbo_assoc_disallowed_attr_t; 158 159 /* Association Disallowed attr Reason code field values */ 160 enum { 161 MBO_ASSOC_DISALLOWED_RC_UNSPECIFIED = 1, 162 MBO_ASSOC_DISALLOWED_RC_MAX_STA_REACHED = 2, 163 MBO_ASSOC_DISALLOWED_RC_AIR_IFACE_OVERLOADED = 3, 164 MBO_ASSOC_DISALLOWED_RC_AUTH_SRVR_OVERLOADED = 4, 165 MBO_ASSOC_DISALLOWED_RC_INSUFFIC_RSSI = 5 166 }; 167 168 /* Cellular Data Conn Pref attribute */ 169 typedef BWL_PRE_PACKED_STRUCT struct wifi_mbo_cell_data_conn_pref_attr_s { 170 /* Attribute ID - 0x05. */ 171 uint8 id; 172 /* Length of the following fields in the attribute */ 173 uint8 len; 174 /* Preference value of cellular connection */ 175 uint8 cell_pref; 176 } BWL_POST_PACKED_STRUCT wifi_mbo_cell_data_conn_pref_attr_t; 177 178 /* Cellular Data Conn Pref attr: Cellular Pref field values */ 179 enum { 180 MBO_CELLULAR_DATA_CONN_EXCLUDED = 1, 181 MBO_CELLULAR_DATA_CONN_NOT_PREFERRED = 2, 182 MBO_CELLULAR_DATA_CONN_PREFERRED = 255 183 }; 184 185 /* Transition Reason Code Attribute */ 186 typedef BWL_PRE_PACKED_STRUCT struct wifi_mbo_trans_reason_code_attr_s { 187 /* Attribute ID - 0x06. */ 188 uint8 id; 189 /* Length of the following fields in the attribute */ 190 uint8 len; 191 /* Reason of transition recommendation */ 192 uint8 trans_reason_code; 193 } BWL_POST_PACKED_STRUCT wifi_mbo_trans_reason_code_attr_t; 194 195 /* Transition Reason Code Attr: trans reason code field values */ 196 enum { 197 MBO_TRANS_REASON_UNSPECIFIED = 0, 198 MBO_TRANS_REASON_EXCESSV_FRM_LOSS_RATE = 1, 199 MBO_TRANS_REASON_EXCESSV_TRAFFIC_DELAY = 2, 200 MBO_TRANS_REASON_INSUFF_BW = 3, 201 MBO_TRANS_REASON_LOAD_BALANCING = 4, 202 MBO_TRANS_REASON_LOW_RSSI = 5, 203 MBO_TRANS_REASON_EXCESSV_RETRANS_RCVD = 6, 204 MBO_TRANS_REASON_HIGH_INTERFERENCE = 7, 205 MBO_TRANS_REASON_GRAY_ZONE = 8, 206 MBO_TRANS_REASON_PREMIUM_AP_TRANS = 9 207 }; 208 209 /* Transition Rejection Reason Code Attribute */ 210 typedef BWL_PRE_PACKED_STRUCT struct wifi_mbo_trans_rej_reason_code_attr_s { 211 /* Attribute ID - 0x07. */ 212 uint8 id; 213 /* Length of the following fields in the attribute */ 214 uint8 len; 215 /* Reason of transition rejection */ 216 uint8 trans_rej_reason_code; 217 } BWL_POST_PACKED_STRUCT wifi_mbo_trans_rej_reason_code_attr_t; 218 219 /* Transition Rej Reason Code Attr: trans rej reason code field values */ 220 enum { 221 MBO_TRANS_REJ_REASON_UNSPECIFIED = 0, 222 MBO_TRANS_REJ_REASON_EXSSIV_FRM_LOSS_RATE = 1, 223 MBO_TRANS_REJ_REASON_EXSSIV_TRAFFIC_DELAY = 2, 224 MBO_TRANS_REJ_REASON_INSUFF_QOS_CAPACITY = 3, 225 MBO_TRANS_REJ_REASON_LOW_RSSI = 4, 226 MBO_TRANS_REJ_REASON_HIGH_INTERFERENCE = 5, 227 MBO_TRANS_REJ_REASON_SERVICE_UNAVAIL = 6 228 }; 229 230 /* Assoc Retry Delay Attribute */ 231 typedef BWL_PRE_PACKED_STRUCT struct wifi_mbo_assoc_retry_delay_attr_s { 232 /* Attribute ID - 0x08. */ 233 uint8 id; 234 /* Length of the following fields in the attribute */ 235 uint8 len; 236 /* No of Seconds before next assoc attempt */ 237 uint16 reassoc_delay; 238 } BWL_POST_PACKED_STRUCT wifi_mbo_assoc_retry_delay_attr_t; 239 240 #define MBO_ANQP_OUI_TYPE 0x12 /* OUTI Type/Version */ 241 242 /* MBO ANQP Element */ 243 typedef BWL_PRE_PACKED_STRUCT struct wifi_mbo_anqp_elem_s { 244 /* ID - 56797 */ 245 uint16 info_id; 246 /* Length of the OUI + Vendor Specific content */ 247 uint16 len; 248 /* WFA_OUI 50:6F:9A */ 249 uint8 oui[WFA_OUI_LEN]; 250 /* MBO_ANQP_OUI_TYPE 0x12 */ 251 uint8 oui_type; 252 /* MBO ANQP element type */ 253 uint8 sub_type; 254 /* variable len payload */ 255 uint8 payload[1]; 256 } BWL_POST_PACKED_STRUCT wifi_mbo_anqp_elem_t; 257 258 #define MBO_ANQP_ELEM_HDR_SIZE (OFFSETOF(wifi_mbo_anqp_elem_t, payload)) 259 260 /* oui:3 bytes + oui type:1 byte + sub type:1 byte */ 261 #define MBO_ANQP_ELEM_NO_PAYLOAD_LEN 5 262 263 /* MBO ANQP Subtype Values */ 264 enum { 265 MBO_ANQP_ELEM_MBO_QUERY_LIST = 1, 266 MBO_ANQP_ELEM_CELL_DATA_CONN_PREF = 2 267 }; 268 269 /* MBO sub-elements */ 270 typedef BWL_PRE_PACKED_STRUCT struct wifi_mbo_cell_cap_subelem_s { 271 /* 0xDD */ 272 uint8 sub_elem_id; 273 /* Length of the following fields in sub-element */ 274 uint8 len; 275 /* WFA_OUI 50:6F:9A */ 276 uint8 oui[WFA_OUI_LEN]; 277 /* OUI_TYPE 0x03 */ 278 uint8 oui_type; 279 /* STA cellular capability */ 280 uint8 cell_conn; 281 } BWL_POST_PACKED_STRUCT wifi_mbo_cell_cap_subelem_t; 282 283 /* This marks the end of a packed structure section. */ 284 #include <packed_section_end.h> 285 286 #endif /* __MBO_H__ */ 287