1 /** @file moal_uap.h 2 * 3 * @brief This file contains uap driver specific defines etc. 4 * 5 * Copyright (C) 2009-2017, Marvell International Ltd. 6 * 7 * This software file (the "File") is distributed by Marvell International 8 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 9 * (the "License"). You may use, redistribute and/or modify this File in 10 * accordance with the terms and conditions of the License, a copy of which 11 * is available by writing to the Free Software Foundation, Inc., 12 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the 13 * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. 14 * 15 * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE 16 * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE 17 * ARE EXPRESSLY DISCLAIMED. The License provides additional details about 18 * this warranty disclaimer. 19 * 20 */ 21 22 /******************************************************** 23 Change log: 24 02/02/2009: initial version 25 ********************************************************/ 26 27 #ifndef _MOAL_UAP_H 28 #define _MOAL_UAP_H 29 30 /** Maximum buffer length for WOAL_UAP_SET_GET_256_CHAR */ 31 #define MAX_BUF_LEN 256 32 33 /** Private command ID to send ioctl */ 34 #define UAP_IOCTL_CMD (SIOCDEVPRIVATE + 2) 35 /** Updating ADDBA variables */ 36 #define UAP_ADDBA_PARA 0 37 /** Updating priority table for AMPDU/AMSDU */ 38 #define UAP_AGGR_PRIOTBL 1 39 /** Updating addbareject table */ 40 41 #define UAP_ADDBA_REJECT 2 42 /** Get FW INFO */ 43 #define UAP_FW_INFO 4 44 /** Updating Deep sleep variables */ 45 #define UAP_DEEP_SLEEP 3 46 /** Tx data pause subcommand */ 47 #define UAP_TX_DATA_PAUSE 5 48 /** sdcmd52 read write subcommand */ 49 #define UAP_SDCMD52_RW 6 50 /** snmp mib subcommand */ 51 #define UAP_SNMP_MIB 7 52 /** domain info subcommand */ 53 #define UAP_DOMAIN_INFO 8 54 /** TX beamforming configuration */ 55 #define UAP_TX_BF_CFG 9 56 #ifdef DFS_TESTING_SUPPORT 57 /** dfs testing subcommand */ 58 #define UAP_DFS_TESTING 10 59 #endif 60 /** sub command ID to set/get Host Sleep configuration */ 61 #define UAP_HS_CFG 11 62 /** sub command ID to set/get Host Sleep Parameters */ 63 #define UAP_HS_SET_PARA 12 64 65 /** Management Frame Control Mask */ 66 #define UAP_MGMT_FRAME_CONTROL 13 67 68 #define UAP_TX_RATE_CFG 14 69 70 #define UAP_DFS_REPEATER_MODE 16 71 72 #define UAP_CAC_TIMER_STATUS 17 73 74 /** Skip CAC */ 75 #define UAP_SKIP_CAC 18 76 77 #define UAP_HT_TX_CFG 19 78 79 #define UAP_OPERATION_CTRL 22 80 81 #define UAP_CHAN_SWITCH_COUNT_CFG 23 82 83 /** Private command ID to Power Mode */ 84 #define UAP_POWER_MODE (SIOCDEVPRIVATE + 3) 85 86 /** Private command id to start/stop/reset bss */ 87 #define UAP_BSS_CTRL (SIOCDEVPRIVATE + 4) 88 /** BSS START */ 89 #define UAP_BSS_START 0 90 /** BSS STOP */ 91 #define UAP_BSS_STOP 1 92 /** BSS RESET */ 93 #define UAP_BSS_RESET 2 94 95 /** wapi_msg */ 96 typedef struct _wapi_msg { 97 /** message type */ 98 t_u16 msg_type; 99 /** message len */ 100 t_u16 msg_len; 101 /** message */ 102 t_u8 msg[96]; 103 } wapi_msg; 104 105 /* wapi key msg */ 106 typedef struct _wapi_key_msg { 107 /** mac address */ 108 t_u8 mac_addr[MLAN_MAC_ADDR_LENGTH]; 109 /** pad */ 110 t_u8 pad; 111 /** key id */ 112 t_u8 key_id; 113 /** key */ 114 t_u8 key[32]; 115 } wapi_key_msg; 116 117 /** Private command ID to set wapi info */ 118 #define UAP_WAPI_MSG (SIOCDEVPRIVATE + 10) 119 /** set wapi flag */ 120 #define P80211_PACKET_WAPIFLAG 0x0001 121 /** set wapi key */ 122 #define P80211_PACKET_SETKEY 0x0003 123 /** wapi mode psk */ 124 #define WAPI_MODE_PSK 0x04 125 /** wapi mode certificate */ 126 #define WAPI_MODE_CERT 0x08 127 128 typedef struct _tx_rate_cfg_t { 129 /** sub command */ 130 int subcmd; 131 /** Action */ 132 int action; 133 /** Rate format */ 134 int rate_format; 135 /** Rate configured */ 136 int rate; 137 /** user_data_cnt */ 138 int user_data_cnt; 139 /** Rate bitmap */ 140 t_u16 bitmap_rates[MAX_BITMAP_RATES_SIZE]; 141 } tx_rate_cfg_t; 142 143 /* dfs repeater mode */ 144 typedef struct _dfs_repeater_mode { 145 /** subcmd */ 146 t_u32 subcmd; 147 /** set/get */ 148 t_u32 action; 149 /** mode */ 150 t_u32 mode; 151 } dfs_repeater_mode; 152 153 /* */ 154 typedef struct _cac_timer_status { 155 /** subcmd */ 156 t_u32 subcmd; 157 /** set/get */ 158 t_u32 action; 159 /** mode */ 160 t_u32 mode; 161 } cac_timer_status; 162 163 /** skip_cac parameters */ 164 typedef struct _skip_cac_para { 165 /** subcmd */ 166 t_u32 subcmd; 167 /** Set/Get */ 168 t_u32 action; 169 /** enable/disable deepsleep*/ 170 t_u16 skip_cac; 171 } skip_cac_para; 172 173 /** radio control command */ 174 #define UAP_RADIO_CTL (SIOCDEVPRIVATE + 5) 175 176 /** Private command ID to BSS config */ 177 #define UAP_BSS_CONFIG (SIOCDEVPRIVATE + 6) 178 179 /** deauth station */ 180 #define UAP_STA_DEAUTH (SIOCDEVPRIVATE + 7) 181 182 /** uap get station list */ 183 #define UAP_GET_STA_LIST (SIOCDEVPRIVATE + 11) 184 #define UAPHOSTPKTINJECT WOAL_MGMT_FRAME_TX_IOCTL 185 186 /** Private command ID to set/get custom IE buffer */ 187 #define UAP_CUSTOM_IE (SIOCDEVPRIVATE + 13) 188 189 /** HS WAKE UP event id */ 190 #define UAP_EVENT_ID_HS_WAKEUP 0x80000001 191 /** HS_ACTIVATED event id */ 192 #define UAP_EVENT_ID_DRV_HS_ACTIVATED 0x80000002 193 /** HS DEACTIVATED event id */ 194 #define UAP_EVENT_ID_DRV_HS_DEACTIVATED 0x80000003 195 196 /** Host sleep flag set */ 197 #define HS_CFG_FLAG_GET 0 198 /** Host sleep flag get */ 199 #define HS_CFG_FLAG_SET 1 200 /** Host sleep flag for condition */ 201 #define HS_CFG_FLAG_CONDITION 2 202 /** Host sleep flag for GPIO */ 203 #define HS_CFG_FLAG_GPIO 4 204 /** Host sleep flag for Gap */ 205 #define HS_CFG_FLAG_GAP 8 206 /** Host sleep flag for all */ 207 #define HS_CFG_FLAG_ALL 0x0f 208 /** Host sleep mask to get condition */ 209 #define HS_CFG_CONDITION_MASK 0x0f 210 211 /** ds_hs_cfg */ 212 typedef struct _ds_hs_cfg { 213 /** subcmd */ 214 t_u32 subcmd; 215 /** Bit0: 0 - Get, 1 Set 216 * Bit1: 1 - conditions is valid 217 * Bit2: 2 - gpio is valid 218 * Bit3: 3 - gap is valid 219 */ 220 t_u32 flags; 221 /** Host sleep config condition */ 222 /** Bit0: non-unicast data 223 * Bit1: unicast data 224 * Bit2: mac events 225 * Bit3: magic packet 226 */ 227 t_u32 conditions; 228 /** GPIO */ 229 t_u32 gpio; 230 /** Gap in milliseconds */ 231 t_u32 gap; 232 } ds_hs_cfg; 233 234 /** Private command ID to get BSS type */ 235 #define UAP_GET_BSS_TYPE (SIOCDEVPRIVATE + 15) 236 237 /** addba_param */ 238 typedef struct _addba_param { 239 /** subcmd */ 240 t_u32 subcmd; 241 /** Set/Get */ 242 t_u32 action; 243 /** block ack timeout for ADDBA request */ 244 t_u32 timeout; 245 /** Buffer size for ADDBA request */ 246 t_u32 txwinsize; 247 /** Buffer size for ADDBA response */ 248 t_u32 rxwinsize; 249 /** amsdu for ADDBA request */ 250 t_u8 txamsdu; 251 /** amsdu for ADDBA response */ 252 t_u8 rxamsdu; 253 } addba_param; 254 255 /** aggr_prio_tbl */ 256 typedef struct _aggr_prio_tbl { 257 /** subcmd */ 258 t_u32 subcmd; 259 /** Set/Get */ 260 t_u32 action; 261 /** ampdu priority table */ 262 t_u8 ampdu[MAX_NUM_TID]; 263 /** amsdu priority table */ 264 t_u8 amsdu[MAX_NUM_TID]; 265 } aggr_prio_tbl; 266 267 /** addba_reject parameters */ 268 typedef struct _addba_reject_para { 269 /** subcmd */ 270 t_u32 subcmd; 271 /** Set/Get */ 272 t_u32 action; 273 /** BA Reject paramters */ 274 t_u8 addba_reject[MAX_NUM_TID]; 275 } addba_reject_para; 276 277 /** fw_info */ 278 typedef struct _fw_info { 279 /** subcmd */ 280 t_u32 subcmd; 281 /** Get */ 282 t_u32 action; 283 /** Firmware release number */ 284 t_u32 fw_release_number; 285 /** Device support for MIMO abstraction of MCSs */ 286 t_u8 hw_dev_mcs_support; 287 /** fw_bands*/ 288 t_u8 fw_bands; 289 /** Region Code */ 290 t_u16 region_code; 291 /** 802.11n device capabilities */ 292 t_u32 hw_dot_11n_dev_cap; 293 } fw_info; 294 295 typedef struct _ht_tx_cfg_para_hdr { 296 /** Sub command */ 297 t_u32 subcmd; 298 /** Action: Set/Get */ 299 t_u32 action; 300 } ht_tx_cfg_para_hdr; 301 302 typedef struct _tx_bf_cfg_para_hdr { 303 /** Sub command */ 304 t_u32 subcmd; 305 /** Action: Set/Get */ 306 t_u32 action; 307 } tx_bf_cfg_para_hdr; 308 309 typedef struct _uap_oper_para_hdr { 310 /** Sub command */ 311 t_u32 subcmd; 312 /** Action: Set/Get */ 313 t_u32 action; 314 } uap_oper_para_hdr; 315 316 /** sdcmd52rw parameters */ 317 typedef struct _sdcmd52_para { 318 /** subcmd */ 319 t_u32 subcmd; 320 /** Write /Read */ 321 t_u32 action; 322 /** Command 52 paramters */ 323 t_u8 cmd52_params[3]; 324 } sdcmd52_para; 325 326 /** deep_sleep parameters */ 327 typedef struct _deep_sleep_para { 328 /** subcmd */ 329 t_u32 subcmd; 330 /** Set/Get */ 331 t_u32 action; 332 /** enable/disable deepsleep*/ 333 t_u16 deep_sleep; 334 /** idle_time */ 335 t_u16 idle_time; 336 } deep_sleep_para; 337 338 /** tx_data_pause parameters */ 339 typedef struct _tx_data_pause_para { 340 /** subcmd */ 341 t_u32 subcmd; 342 /** Set/Get */ 343 t_u32 action; 344 /** enable/disable Tx data pause*/ 345 t_u16 txpause; 346 /** Max number of TX buffer allowed for all PS client*/ 347 t_u16 txbufcnt; 348 } tx_data_pause_para; 349 350 /** mgmt_frame_ctrl */ 351 typedef struct _mgmt_frame_ctrl { 352 /** subcmd */ 353 t_u32 subcmd; 354 /** Set/Get */ 355 t_u32 action; 356 /** mask */ 357 t_u32 mask; 358 } mgmt_frame_ctrl; 359 360 typedef struct _snmp_mib_para { 361 /** subcmd */ 362 t_u32 subcmd; 363 /** Set/Get */ 364 t_u32 action; 365 /** oid to set/get */ 366 t_u16 oid; 367 /** length of oid value */ 368 t_u16 oid_val_len; 369 /** oid value to set/get */ 370 t_u8 oid_value[0]; 371 } snmp_mib_para; 372 373 /** Max length for oid_value field */ 374 #define MAX_SNMP_VALUE_SIZE 128 375 376 /** Oid for 802.11D enable/disable */ 377 #define OID_80211D_ENABLE 0x0009 378 /** Oid for 802.11H enable/disable */ 379 #define OID_80211H_ENABLE 0x000a 380 381 #ifdef DFS_TESTING_SUPPORT 382 /** dfs_testing parameters */ 383 typedef struct _dfs_testing_param { 384 /** subcmd */ 385 t_u32 subcmd; 386 /** Set/Get */ 387 t_u32 action; 388 /** user CAC period (msec) */ 389 t_u32 usr_cac_period; 390 /** user NOP period (sec) */ 391 t_u16 usr_nop_period; 392 /** don't change channel on radar */ 393 t_u8 no_chan_change; 394 /** fixed channel to change to on radar */ 395 t_u8 fixed_new_chan; 396 } dfs_testing_para; 397 #endif 398 399 /** Channel switch count config */ 400 typedef struct _cscount_cfg_t { 401 /** subcmd */ 402 t_u32 subcmd; 403 /** Set/Get */ 404 t_u32 action; 405 /** user channel switch count */ 406 t_u8 cs_count; 407 } cscount_cfg_t; 408 409 /** domain_info parameters */ 410 typedef struct _domain_info_param { 411 /** subcmd */ 412 t_u32 subcmd; 413 /** Set/Get */ 414 t_u32 action; 415 /** domain_param TLV (incl. header) */ 416 t_u8 tlv[0]; 417 } domain_info_para; 418 419 /** DOMAIN_INFO param sizes */ 420 #define TLV_HEADER_LEN (2 + 2) 421 #define SUB_BAND_LEN 3 422 #define MAX_SUB_BANDS 40 423 424 /** MAX domain TLV length */ 425 #define MAX_DOMAIN_TLV_LEN (TLV_HEADER_LEN + COUNTRY_CODE_LEN \ 426 + (SUB_BAND_LEN * MAX_SUB_BANDS)) 427 428 int woal_set_get_uap_power_mode(moal_private *priv, t_u32 action, 429 mlan_ds_ps_mgmt *ps_mgmt); 430 void woal_uap_set_multicast_list(struct net_device *dev); 431 int woal_uap_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd); 432 int woal_uap_bss_ctrl(moal_private *priv, t_u8 wait_option, int data); 433 #ifdef UAP_CFG80211 434 #if defined(DFS_TESTING_SUPPORT) 435 #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 12, 0) 436 int woal_uap_get_channel_nop_info(moal_private *priv, t_u8 wait_option, 437 mlan_ds_11h_chan_nop_info * ch_info); 438 #endif 439 #endif 440 #endif 441 mlan_status woal_set_get_ap_channel(moal_private *priv, t_u16 action, 442 t_u8 wait_option, 443 chan_band_info * uap_channel); 444 #ifdef CONFIG_PROC_FS 445 void woal_uap_get_version(moal_private *priv, char *version, int max_len); 446 #endif 447 mlan_status woal_uap_get_stats(moal_private *priv, t_u8 wait_option, 448 mlan_ds_uap_stats *ustats); 449 #if defined(UAP_WEXT) || defined(UAP_CFG80211) 450 extern struct iw_handler_def woal_uap_handler_def; 451 struct iw_statistics *woal_get_uap_wireless_stats(struct net_device *dev); 452 /** IOCTL function for wireless private IOCTLs */ 453 int woal_uap_do_priv_ioctl(struct net_device *dev, struct ifreq *req, int cmd); 454 #endif 455 /** Set invalid data for each member of mlan_uap_bss_param */ 456 void woal_set_sys_config_invalid_data(mlan_uap_bss_param *config); 457 /** Set/Get system configuration parameters */ 458 mlan_status woal_set_get_sys_config(moal_private *priv, 459 t_u16 action, t_u8 wait_option, 460 mlan_uap_bss_param *sys_cfg); 461 /** Set get AP wmm parameter */ 462 mlan_status woal_set_get_ap_wmm_para(moal_private *priv, t_u16 action, 463 wmm_parameter_t *ap_wmm_para); 464 int woal_uap_set_ap_cfg(moal_private *priv, t_u8 *data, int len); 465 int woal_set_uap_ht_tx_cfg(moal_private *priv, Band_Config_t bandcfg, t_u8 en); 466 mlan_status woal_uap_set_11n_status(moal_private *priv, 467 mlan_uap_bss_param *sys_cfg, t_u8 action); 468 #ifdef UAP_WEXT 469 void woal_ioctl_get_uap_info_resp(moal_private *priv, mlan_ds_get_info *info); 470 int woal_set_get_custom_ie(moal_private *priv, t_u16 mask, t_u8 *ie, 471 int ie_len); 472 #endif /* UAP_WEXT */ 473 474 #endif /* _MOAL_UAP_H */ 475