1 /* 2 * Copyright (c) 2016-2020 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved. 4 * 5 * Permission to use, copy, modify, and/or distribute this software for 6 * any purpose with or without fee is hereby granted, provided that the 7 * above copyright notice and this permission notice appear in all 8 * copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 12 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 13 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 14 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 15 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 16 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 17 * PERFORMANCE OF THIS SOFTWARE. 18 */ 19 20 /** 21 * DOC: Declare structs and macros which can be accessed by various 22 * components and modules. 23 */ 24 25 #ifndef _WLAN_ACTION_OUI_PUBLIC_STRUCT_H_ 26 #define _WLAN_ACTION_OUI_PUBLIC_STRUCT_H_ 27 28 #include <wlan_cmn.h> 29 #include <qdf_status.h> 30 #include <qdf_types.h> 31 32 /* 33 * Maximum ini string length of actions oui extensions, 34 * (n * 83) + (n - 1) spaces + 1 (terminating character), 35 * where n is the no of oui extensions 36 * currently, max no of oui extensions is 10 37 */ 38 #define ACTION_OUI_MAX_STR_LEN 840 39 40 /* 41 * Maximum number of action oui extensions supported in 42 * each action oui category 43 */ 44 #define ACTION_OUI_MAX_EXTENSIONS 10 45 46 /* 47 * Firmware allocates memory for the extensions only during init time. 48 * Therefore, inaddition to the total extensions configured during 49 * init time, driver has to add extra space to allow runtime extensions. 50 * 51 * Example: ACTION_OUI_11BE_OUI_ALLOW 52 * 53 * Max. value should be increased with the addition of new runtime extensions. 54 */ 55 #define ACTION_OUI_MAX_ADDNL_EXTENSIONS 10 56 57 #define ACTION_OUI_MAX_OUI_LENGTH 5 58 #define ACTION_OUI_MAX_DATA_LENGTH 20 59 #define ACTION_OUI_MAX_DATA_MASK_LENGTH 3 60 #define ACTION_OUI_MAC_MASK_LENGTH 1 61 #define ACTION_OUI_MAX_CAPABILITY_LENGTH 1 62 63 /* 64 * NSS Mask and NSS Offset to extract NSS info from 65 * capability field of action oui extension 66 */ 67 #define ACTION_OUI_CAPABILITY_NSS_MASK 0x0f 68 #define ACTION_OUI_CAPABILITY_NSS_OFFSET 0 69 #define ACTION_OUI_CAPABILITY_NSS_MASK_1X1 1 70 #define ACTION_OUI_CAPABILITY_NSS_MASK_2X2 2 71 #define ACTION_OUI_CAPABILITY_NSS_MASK_3X3 4 72 #define ACTION_OUI_CAPABILITY_NSS_MASK_4X4 8 73 74 /* 75 * Mask and offset to extract HT and VHT info from 76 * capability field of action oui extension 77 */ 78 #define ACTION_OUI_CAPABILITY_HT_ENABLE_MASK 0x10 79 #define ACTION_OUI_CAPABILITY_HT_ENABLE_OFFSET 4 80 #define ACTION_OUI_CAPABILITY_VHT_ENABLE_MASK 0x20 81 #define ACTION_OUI_CAPABILITY_VHT_ENABLE_OFFSET 5 82 83 /* 84 * Mask and offset to extract Band (2G and 5G) info from 85 * capability field of action oui extension 86 */ 87 #define ACTION_OUI_CAPABILITY_BAND_MASK 0xC0 88 #define ACTION_OUI_CAPABILITY_BAND_OFFSET 6 89 #define ACTION_OUI_CAPABILITY_2G_BAND_MASK 0x40 90 #define ACTION_OUI_CAPABILITY_2G_BAND_OFFSET 6 91 #define ACTION_CAPABILITY_5G_BAND_MASK 0x80 92 #define ACTION_CAPABILITY_5G_BAND_OFFSET 7 93 94 /* Invalid OUI ID action */ 95 #define ACTION_OUI_INVALID "ffffff 00 01" 96 97 /** 98 * enum action_oui_id - to identify type of action oui 99 * @ACTION_OUI_CONNECT_1X1: for 1x1 connection only 100 * @ACTION_OUI_ITO_EXTENSION: for extending inactivity time of station 101 * @ACTION_OUI_CCKM_1X1: for TX with CCKM 1x1 only 102 * @ACTION_OUI_ITO_ALTERNATE: alternate ITO extensions used by firmware 103 * @ACTION_OUI_SWITCH_TO_11N_MODE: connect in 11n 104 * @ACTION_OUI_CONNECT_1X1_WITH_1_CHAIN: connect in 1x1 & disable diversity gain 105 * @ACTION_OUI_DISABLE_AGGRESSIVE_TX: disable aggressive TX in firmware 106 * @ACTION_OUI_DISABLE_AGGRESSIVE_EDCA: disable aggressive EDCA with the ap 107 * @ACTION_OUI_DISABLE_TWT: disable TWT with the ap 108 * @ACTION_OUI_EXTEND_WOW_ITO: extend ITO under WOW mode if vendor OUI is 109 * received in beacon. 110 * @ACTION_OUI_11BE_OUI_ALLOW: ap oui for which station can connect with 111 * 11be mode 112 * @ACTION_OUI_DISABLE_DYNAMIC_QOS_NULL_TX_RATE: Turn off FW's dynamic qos 113 * null tx rate feature if specific vendor OUI received in beacon 114 * @ACTION_OUI_ENABLE_CTS2SELF_WITH_QOS_NULL: Enable CTS2SELF with QoS null 115 * frame for specified IoT APs. 116 * @ACTION_OUI_SEND_SMPS_FRAME_WITH_OMN: Send SMPS frame along with OMN 117 * frame for specified IoT APs. 118 * @ACTION_OUI_HOST_ONLY: host only action id start - placeholder. 119 * New Firmware related "ACTION" needs to be added before this placeholder. 120 * @ACTION_OUI_HOST_RECONN: reconnect to the same BSSID when wait for 121 * association response timeout from AP 122 * @ACTION_OUI_TAKE_ALL_BAND_INFO: let AP country ie take all band info 123 * @ACTION_OUI_AUTH_ASSOC_6MBPS_2GHZ: send auth/assoc req with 6 Mbps rate 124 * on 2.4 GHz 125 * @ACTION_OUI_DISABLE_BFORMEE: disable SU/MU beam formee capability for 126 * specified AP 127 * @ACTION_OUI_ENABLE_CTS2SELF: enable cts to self for specified AP's 128 * @ACTION_OUI_RESTRICT_MAX_MLO_LINKS: Downgrade MLO if particular AP 129 * build present. 130 * @ACTION_OUI_LIMIT_BW: Limit BW if vendor OUI is received in beacon. 131 * @ACTION_OUI_MAXIMUM_ID: maximum number of action oui types 132 */ 133 enum action_oui_id { 134 ACTION_OUI_CONNECT_1X1 = 0, 135 ACTION_OUI_ITO_EXTENSION = 1, 136 ACTION_OUI_CCKM_1X1 = 2, 137 ACTION_OUI_ITO_ALTERNATE = 3, 138 ACTION_OUI_SWITCH_TO_11N_MODE = 4, 139 ACTION_OUI_CONNECT_1X1_WITH_1_CHAIN = 5, 140 ACTION_OUI_DISABLE_AGGRESSIVE_TX = 6, 141 ACTION_OUI_DISABLE_TWT = 7, 142 ACTION_OUI_EXTEND_WOW_ITO = 8, 143 ACTION_OUI_11BE_OUI_ALLOW = 9, 144 ACTION_OUI_DISABLE_DYNAMIC_QOS_NULL_TX_RATE = 10, 145 ACTION_OUI_ENABLE_CTS2SELF_WITH_QOS_NULL = 11, 146 ACTION_OUI_SEND_SMPS_FRAME_WITH_OMN = 12, 147 /* host&fw interface add above here */ 148 149 ACTION_OUI_HOST_ONLY, 150 ACTION_OUI_HOST_RECONN = ACTION_OUI_HOST_ONLY, 151 ACTION_OUI_TAKE_ALL_BAND_INFO, 152 ACTION_OUI_AUTH_ASSOC_6MBPS_2GHZ, 153 ACTION_OUI_DISABLE_BFORMEE, 154 ACTION_OUI_DISABLE_AGGRESSIVE_EDCA, 155 ACTION_OUI_ENABLE_CTS2SELF, 156 ACTION_OUI_RESTRICT_MAX_MLO_LINKS, 157 ACTION_OUI_LIMIT_BW, 158 ACTION_OUI_MAXIMUM_ID 159 }; 160 161 /** 162 * enum action_oui_info - to indicate presence of various action OUI 163 * fields in action oui extension, following identifiers are to be set in 164 * the info mask field of action oui extension 165 * @ACTION_OUI_INFO_OUI: to indicate presence of OUI string 166 * @ACTION_OUI_INFO_MAC_ADDRESS: to indicate presence of mac address 167 * @ACTION_OUI_INFO_AP_CAPABILITY_NSS: to indicate presence of nss info 168 * @ACTION_OUI_INFO_AP_CAPABILITY_HT: to indicate presence of HT cap 169 * @ACTION_OUI_INFO_AP_CAPABILITY_VHT: to indicate presence of VHT cap 170 * @ACTION_OUI_INFO_AP_CAPABILITY_BAND: to indicate presence of band info 171 */ 172 enum action_oui_info { 173 /* 174 * OUI centric parsing, expect OUI in each action OUI extension, 175 * hence, ACTION_OUI_INFO_OUI is dummy 176 */ 177 ACTION_OUI_INFO_OUI = 1 << 0, 178 ACTION_OUI_INFO_MAC_ADDRESS = 1 << 1, 179 ACTION_OUI_INFO_AP_CAPABILITY_NSS = 1 << 2, 180 ACTION_OUI_INFO_AP_CAPABILITY_HT = 1 << 3, 181 ACTION_OUI_INFO_AP_CAPABILITY_VHT = 1 << 4, 182 ACTION_OUI_INFO_AP_CAPABILITY_BAND = 1 << 5, 183 }; 184 185 /* Total mask of all enum action_oui_info IDs */ 186 #define ACTION_OUI_INFO_MASK 0x3F 187 188 /** 189 * struct action_oui_extension - action oui extension contents 190 * @info_mask: info mask 191 * @oui_length: length of the oui, either 3 or 5 bytes 192 * @data_length: length of the oui data 193 * @data_mask_length: length of the data mask 194 * @mac_addr_length: length of the mac addr 195 * @mac_mask_length: length of the mac mask 196 * @capability_length: length of the capability 197 * @oui: oui value 198 * @data: data buffer 199 * @data_mask: data mask buffer 200 * @mac_addr: mac addr 201 * @mac_mask: mac mask 202 * @capability: capability buffer 203 */ 204 struct action_oui_extension { 205 uint32_t info_mask; 206 uint32_t oui_length; 207 uint32_t data_length; 208 uint32_t data_mask_length; 209 uint32_t mac_addr_length; 210 uint32_t mac_mask_length; 211 uint32_t capability_length; 212 uint8_t oui[ACTION_OUI_MAX_OUI_LENGTH]; 213 uint8_t data[ACTION_OUI_MAX_DATA_LENGTH]; 214 uint8_t data_mask[ACTION_OUI_MAX_DATA_MASK_LENGTH]; 215 uint8_t mac_addr[QDF_MAC_ADDR_SIZE]; 216 uint8_t mac_mask[ACTION_OUI_MAC_MASK_LENGTH]; 217 uint8_t capability[ACTION_OUI_MAX_CAPABILITY_LENGTH]; 218 }; 219 220 /** 221 * struct action_oui_request - Contains specific action oui information 222 * @action_id: type of action from enum action_oui_info 223 * @no_oui_extensions: number of action oui extensions of type @action_id 224 * @total_no_oui_extensions: total no of oui extensions from all 225 * action oui types, this is just a total count needed by firmware 226 * @extension: pointer to zero length array, to indicate this structure is 227 * followed by a array of @no_oui_extensions structures of 228 * type struct action_oui_extension 229 */ 230 struct action_oui_request { 231 enum action_oui_id action_id; 232 uint32_t no_oui_extensions; 233 uint32_t total_no_oui_extensions; 234 struct action_oui_extension extension[]; 235 }; 236 237 /** 238 * struct action_oui_search_attr - Used to check against action_oui ini input 239 * 240 * @ie_data: beacon ie data 241 * @ie_length: length of ie data 242 * @mac_addr: bssid of access point 243 * @nss: AP spatial stream info 244 * @ht_cap: Whether AP is HT capable 245 * @vht_cap: Whether AP is VHT capable 246 * @enable_2g: Whether 2.4GHz band is enabled in AP 247 * @enable_5g: Whether 5GHz band is enabled in AP 248 */ 249 struct action_oui_search_attr { 250 uint8_t *ie_data; 251 uint32_t ie_length; 252 uint8_t *mac_addr; 253 uint32_t nss; 254 bool ht_cap; 255 bool vht_cap; 256 bool enable_2g; 257 bool enable_5g; 258 }; 259 260 #endif /* _WLAN_ACTION_OUI_PUBLIC_STRUCT_H_ */ 261