1 /** @file moal_uap.h 2 * 3 * @brief This file contains uap driver specific defines etc. 4 * 5 * 6 * Copyright 2008-2022 NXP 7 * 8 * This software file (the File) is distributed by NXP 9 * under the terms of the GNU General Public License Version 2, June 1991 10 * (the License). You may use, redistribute and/or modify the File in 11 * accordance with the terms and conditions of the License, a copy of which 12 * is available by writing to the Free Software Foundation, Inc., 13 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the 14 * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. 15 * 16 * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE 17 * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE 18 * ARE EXPRESSLY DISCLAIMED. The License provides additional details about 19 * this warranty disclaimer. 20 * 21 */ 22 23 /******************************************************** 24 Change log: 25 02/02/2009: initial version 26 ********************************************************/ 27 28 #ifndef _MOAL_UAP_H 29 #define _MOAL_UAP_H 30 31 /** Maximum buffer length for WOAL_UAP_SET_GET_256_CHAR */ 32 #define MAX_BUF_LEN 256 33 34 /** Private command ID to send ioctl */ 35 #define UAP_IOCTL_CMD (SIOCDEVPRIVATE + 2) 36 /** Updating ADDBA variables */ 37 #define UAP_ADDBA_PARA 0 38 /** Updating priority table for AMPDU/AMSDU */ 39 #define UAP_AGGR_PRIOTBL 1 40 /** Updating addbareject table */ 41 42 #define UAP_ADDBA_REJECT 2 43 /** Get FW INFO */ 44 #define UAP_FW_INFO 4 45 /** Updating Deep sleep variables */ 46 #define UAP_DEEP_SLEEP 3 47 /** Tx data pause subcommand */ 48 #define UAP_TX_DATA_PAUSE 5 49 #ifdef SDIO 50 /** sdcmd52 read write subcommand */ 51 #define UAP_SDCMD52_RW 6 52 #endif 53 /** snmp mib subcommand */ 54 #define UAP_SNMP_MIB 7 55 /** domain info subcommand */ 56 #define UAP_DOMAIN_INFO 8 57 /** TX beamforming configuration */ 58 #define UAP_TX_BF_CFG 9 59 /** dfs testing subcommand */ 60 #define UAP_DFS_TESTING 10 61 /** sub command ID to set/get Host Sleep configuration */ 62 #define UAP_HS_CFG 11 63 /** sub command ID to set/get Host Sleep Parameters */ 64 #define UAP_HS_SET_PARA 12 65 66 /** Management Frame Control Mask */ 67 #define UAP_MGMT_FRAME_CONTROL 13 68 69 #define UAP_TX_RATE_CFG 14 70 71 /** Subcommand ID to set/get antenna configuration */ 72 #define UAP_ANTENNA_CFG 15 73 74 #define UAP_DFS_REPEATER_MODE 16 75 76 #define UAP_CAC_TIMER_STATUS 17 77 78 /** Skip CAC */ 79 #define UAP_SKIP_CAC 18 80 81 #define UAP_HT_TX_CFG 19 82 83 #define UAP_VHT_CFG 20 84 85 #define UAP_HT_STREAM_CFG 21 86 87 #define UAP_OPERATION_CTRL 22 88 89 #define UAP_CHAN_SWITCH_COUNT_CFG 23 90 #define UAP_BAND_STEER 24 91 92 #define UAP_BEACON_STUCK_DETECT 25 93 94 /** Private command ID to Power Mode */ 95 #define UAP_POWER_MODE (SIOCDEVPRIVATE + 3) 96 97 /** Private command id to start/stop/reset bss */ 98 #define UAP_BSS_CTRL (SIOCDEVPRIVATE + 4) 99 /** BSS START */ 100 #define UAP_BSS_START 0 101 /** BSS STOP */ 102 #define UAP_BSS_STOP 1 103 /** BSS RESET */ 104 #define UAP_BSS_RESET 2 105 106 /** wapi_msg */ 107 typedef struct _wapi_msg { 108 /** message type */ 109 t_u16 msg_type; 110 /** message len */ 111 t_u16 msg_len; 112 /** message */ 113 t_u8 msg[96]; 114 } wapi_msg; 115 116 /* wapi key msg */ 117 typedef struct _wapi_key_msg { 118 /** mac address */ 119 t_u8 mac_addr[MLAN_MAC_ADDR_LENGTH]; 120 /** pad */ 121 t_u8 pad; 122 /** key id */ 123 t_u8 key_id; 124 /** key */ 125 t_u8 key[32]; 126 } wapi_key_msg; 127 128 /** Private command ID to set wapi info */ 129 #define UAP_WAPI_MSG (SIOCDEVPRIVATE + 10) 130 /** set wapi flag */ 131 #define P80211_PACKET_WAPIFLAG 0x0001 132 /** set wapi key */ 133 #define P80211_PACKET_SETKEY 0x0003 134 /** wapi mode psk */ 135 #define WAPI_MODE_PSK 0x04 136 /** wapi mode certificate */ 137 #define WAPI_MODE_CERT 0x08 138 139 typedef struct _tx_rate_cfg_t { 140 /** sub command */ 141 int subcmd; 142 /** Action */ 143 int action; 144 /** Rate format */ 145 int rate_format; 146 /** Rate configured */ 147 int rate; 148 /** nss */ 149 int nss; 150 /** user_data_cnt */ 151 int user_data_cnt; 152 /** Rate bitmap */ 153 t_u16 bitmap_rates[MAX_BITMAP_RATES_SIZE]; 154 /** Rate Setting */ 155 t_u16 rate_setting; 156 } tx_rate_cfg_t; 157 158 /** ant_cfg structure */ 159 typedef struct _ant_cfg_t { 160 /** Subcommand */ 161 int subcmd; 162 /** Action */ 163 int action; 164 /** TX mode configured */ 165 int tx_mode; 166 /** RX mode configured */ 167 int rx_mode; 168 } ant_cfg_t; 169 170 /** htstream_cfg structure */ 171 typedef struct _htstream_cfg_t { 172 /** Subcommand */ 173 int subcmd; 174 /** Action */ 175 int action; 176 /** HT stream configuration */ 177 t_u32 stream_cfg; 178 } htstream_cfg_t; 179 180 /* dfs repeater mode */ 181 typedef struct _dfs_repeater_mode { 182 /** subcmd */ 183 t_u32 subcmd; 184 /** set/get */ 185 t_u32 action; 186 /** mode */ 187 t_u32 mode; 188 } dfs_repeater_mode; 189 190 /* */ 191 typedef struct _cac_timer_status { 192 /** subcmd */ 193 t_u32 subcmd; 194 /** set/get */ 195 t_u32 action; 196 /** mode */ 197 t_u32 mode; 198 } cac_timer_status; 199 200 /** skip_cac parameters */ 201 typedef struct _skip_cac_para { 202 /** subcmd */ 203 t_u32 subcmd; 204 /** Set */ 205 t_u32 action; 206 /** enable/disable skip cac*/ 207 t_u16 skip_cac; 208 /** channel */ 209 t_u8 channel; 210 /** bandwidth */ 211 t_u8 bw; 212 } skip_cac_para; 213 214 /** radio control command */ 215 #define UAP_RADIO_CTL (SIOCDEVPRIVATE + 5) 216 217 /** Private command ID to BSS config */ 218 #define UAP_BSS_CONFIG (SIOCDEVPRIVATE + 6) 219 220 /** deauth station */ 221 #define UAP_STA_DEAUTH (SIOCDEVPRIVATE + 7) 222 223 /** enable UAP report mic error */ 224 #define UAP_REPORT_MIC_ERR (SIOCDEVPRIVATE + 8) 225 /** uap set key */ 226 #define UAP_SET_KEY (SIOCDEVPRIVATE + 9) 227 /** encrypt key */ 228 typedef struct _encrypt_key { 229 /** Key index */ 230 t_u32 key_index; 231 /** Key length */ 232 t_u32 key_len; 233 /** Key */ 234 t_u8 key_material[MLAN_MAX_KEY_LENGTH]; 235 /** mac address */ 236 t_u8 mac_addr[MLAN_MAC_ADDR_LENGTH]; 237 } encrypt_key; 238 239 /** pkt_header */ 240 typedef struct _pkt_header { 241 /** pkt_len */ 242 u32 pkt_len; 243 /** pkt_type */ 244 u32 TxPktType; 245 /** tx control */ 246 u32 TxControl; 247 } pkt_header; 248 /** uap get station list */ 249 #define UAP_GET_STA_LIST (SIOCDEVPRIVATE + 11) 250 /** Packet inject command ioctl number */ 251 #define UAPHOSTPKTINJECT WOAL_MGMT_FRAME_TX_IOCTL 252 253 /** Private command ID to set/get custom IE buffer */ 254 #define UAP_CUSTOM_IE (SIOCDEVPRIVATE + 13) 255 256 /** HS WAKE UP event id */ 257 #define UAP_EVENT_ID_HS_WAKEUP 0x80000001 258 /** HS_ACTIVATED event id */ 259 #define UAP_EVENT_ID_DRV_HS_ACTIVATED 0x80000002 260 /** HS DEACTIVATED event id */ 261 #define UAP_EVENT_ID_DRV_HS_DEACTIVATED 0x80000003 262 263 /** Host sleep flag set */ 264 #define HS_CFG_FLAG_GET 0 265 /** Host sleep flag get */ 266 #define HS_CFG_FLAG_SET 1 267 /** Host sleep flag for condition */ 268 #define HS_CFG_FLAG_CONDITION 2 269 /** Host sleep flag for GPIO */ 270 #define HS_CFG_FLAG_GPIO 4 271 /** Host sleep flag for Gap */ 272 #define HS_CFG_FLAG_GAP 8 273 /** Host sleep flag for all */ 274 #define HS_CFG_FLAG_ALL 0x0f 275 /** Host sleep mask to get condition */ 276 #define HS_CFG_CONDITION_MASK 0x0f 277 278 /** ds_hs_cfg */ 279 typedef struct _ds_hs_cfg { 280 /** subcmd */ 281 t_u32 subcmd; 282 /** Bit0: 0 - Get, 1 Set 283 * Bit1: 1 - conditions is valid 284 * Bit2: 2 - gpio is valid 285 * Bit3: 3 - gap is valid 286 */ 287 t_u32 flags; 288 /** Host sleep config condition */ 289 /** Bit0: non-unicast data 290 * Bit1: unicast data 291 * Bit2: mac events 292 * Bit3: magic packet 293 */ 294 t_u32 conditions; 295 /** GPIO */ 296 t_u32 gpio; 297 /** Gap in milliseconds */ 298 t_u32 gap; 299 } ds_hs_cfg; 300 301 /** Private command ID to get BSS type */ 302 #define UAP_GET_BSS_TYPE (SIOCDEVPRIVATE + 15) 303 304 /** addba_param */ 305 typedef struct _uap_addba_param { 306 /** subcmd */ 307 t_u32 subcmd; 308 /** Set/Get */ 309 t_u32 action; 310 /** block ack timeout for ADDBA request */ 311 t_u32 timeout; 312 /** Buffer size for ADDBA request */ 313 t_u32 txwinsize; 314 /** Buffer size for ADDBA response */ 315 t_u32 rxwinsize; 316 /** amsdu for ADDBA request */ 317 t_u8 txamsdu; 318 /** amsdu for ADDBA response */ 319 t_u8 rxamsdu; 320 } uap_addba_param; 321 322 /** aggr_prio_tbl */ 323 typedef struct _uap_aggr_prio_tbl { 324 /** subcmd */ 325 t_u32 subcmd; 326 /** Set/Get */ 327 t_u32 action; 328 /** ampdu priority table */ 329 t_u8 ampdu[MAX_NUM_TID]; 330 /** amsdu priority table */ 331 t_u8 amsdu[MAX_NUM_TID]; 332 } uap_aggr_prio_tbl; 333 334 /** addba_reject parameters */ 335 typedef struct _addba_reject_para { 336 /** subcmd */ 337 t_u32 subcmd; 338 /** Set/Get */ 339 t_u32 action; 340 /** BA Reject paramters */ 341 t_u8 addba_reject[MAX_NUM_TID]; 342 } addba_reject_para; 343 344 /** fw_info */ 345 typedef struct _uap_fw_info { 346 /** subcmd */ 347 t_u32 subcmd; 348 /** Get */ 349 t_u32 action; 350 /** Firmware release number */ 351 t_u32 fw_release_number; 352 /** Device support for MIMO abstraction of MCSs */ 353 t_u8 hw_dev_mcs_support; 354 /** fw_bands*/ 355 t_u8 fw_bands; 356 /** Region Code */ 357 t_u16 region_code; 358 /** 802.11n device capabilities */ 359 t_u32 hw_dot_11n_dev_cap; 360 } uap_fw_info; 361 362 typedef struct _ht_tx_cfg_para_hdr { 363 /** Sub command */ 364 t_u32 subcmd; 365 /** Action: Set/Get */ 366 t_u32 action; 367 } ht_tx_cfg_para_hdr; 368 369 typedef struct _tx_bf_cfg_para_hdr { 370 /** Sub command */ 371 t_u32 subcmd; 372 /** Action: Set/Get */ 373 t_u32 action; 374 } tx_bf_cfg_para_hdr; 375 376 typedef struct _vht_cfg_para_hdr { 377 /** Sub command */ 378 t_u32 subcmd; 379 /** Action: Set/Get */ 380 t_u32 action; 381 } vht_cfg_para_hdr; 382 383 typedef struct _uap_oper_para_hdr { 384 /** Sub command */ 385 t_u32 subcmd; 386 /** Action: Set/Get */ 387 t_u32 action; 388 } uap_oper_para_hdr; 389 390 #ifdef SDIO 391 /** sdcmd52rw parameters */ 392 typedef struct _sdcmd52_para { 393 /** subcmd */ 394 t_u32 subcmd; 395 /** Write /Read */ 396 t_u32 action; 397 /** Command 52 paramters */ 398 t_u8 cmd52_params[3]; 399 } sdcmd52_para; 400 #endif 401 402 /** deep_sleep parameters */ 403 typedef struct _deep_sleep_para { 404 /** subcmd */ 405 t_u32 subcmd; 406 /** Set/Get */ 407 t_u32 action; 408 /** enable/disable deepsleep*/ 409 t_u16 deep_sleep; 410 /** idle_time */ 411 t_u16 idle_time; 412 } deep_sleep_para; 413 414 /** band_steering parameters */ 415 typedef struct _band_steer_para { 416 /** subcmd */ 417 t_u32 subcmd; 418 /** Set/Get */ 419 t_u8 action; 420 /** enable/disable band steering*/ 421 t_u8 state; 422 /** Probe Response will be blocked to 2G channel for first 423 * block_2g_prb_req probe requests*/ 424 t_u8 block_2g_prb_req; 425 /** When band steering is enabled, limit the btm request sent to STA at 426 * <max_btm_req_allowed>*/ 427 t_u8 max_btm_req_allowed; 428 429 } band_steer_para; 430 431 /** beacon stuck detect mechanism parameters */ 432 typedef struct _beacon_stuck_detect_para { 433 /** subcmd */ 434 t_u32 subcmd; 435 /** Set/Get */ 436 t_u8 action; 437 /** No of beacon interval after which firmware will check if beacon Tx 438 * is going fine */ 439 t_u8 beacon_stuck_detect_count; 440 /** Upon performing MAC reset, no of beacon interval after which 441 * firmware will check if recovery was successful */ 442 t_u8 recovery_confirm_count; 443 } beacon_stuck_detect_para; 444 445 /** tx_data_pause parameters */ 446 typedef struct _tx_data_pause_para { 447 /** subcmd */ 448 t_u32 subcmd; 449 /** Set/Get */ 450 t_u32 action; 451 /** enable/disable Tx data pause*/ 452 t_u16 txpause; 453 /** Max number of TX buffer allowed for all PS client*/ 454 t_u16 txbufcnt; 455 } tx_data_pause_para; 456 457 /** mgmt_frame_ctrl */ 458 typedef struct _mgmt_frame_ctrl { 459 /** subcmd */ 460 t_u32 subcmd; 461 /** Set/Get */ 462 t_u32 action; 463 /** mask */ 464 t_u32 mask; 465 } mgmt_frame_ctrl; 466 467 typedef struct _snmp_mib_para { 468 /** subcmd */ 469 t_u32 subcmd; 470 /** Set/Get */ 471 t_u32 action; 472 /** oid to set/get */ 473 t_u16 oid; 474 /** length of oid value */ 475 t_u16 oid_val_len; 476 /** oid value to set/get */ 477 t_u8 oid_value[]; 478 } snmp_mib_para; 479 480 /** Max length for oid_value field */ 481 #define MAX_SNMP_VALUE_SIZE 128 482 483 /** Oid for 802.11D enable/disable */ 484 #define OID_80211D_ENABLE 0x0009 485 /** Oid for 802.11H enable/disable */ 486 #define OID_80211H_ENABLE 0x000a 487 488 int woal_uap_11h_ctrl(moal_private *priv, t_u32 enable); 489 490 /** dfs_testing parameters */ 491 typedef struct _dfs_testing_param { 492 /** subcmd */ 493 t_u32 subcmd; 494 /** Set/Get */ 495 t_u32 action; 496 /** user CAC period (msec) */ 497 t_u32 usr_cac_period; 498 /** user NOP period (sec) */ 499 t_u16 usr_nop_period; 500 /** don't change channel on radar */ 501 t_u8 no_chan_change; 502 /** fixed channel to change to on radar */ 503 t_u8 fixed_new_chan; 504 /** CAC restart */ 505 t_u8 cac_restart; 506 } dfs_testing_para; 507 508 /** Channel switch count config */ 509 typedef struct _cscount_cfg_t { 510 /** subcmd */ 511 t_u32 subcmd; 512 /** Set/Get */ 513 t_u32 action; 514 /** user channel switch count */ 515 t_u8 cs_count; 516 } cscount_cfg_t; 517 518 /** domain_info parameters */ 519 typedef struct _domain_info_param { 520 /** subcmd */ 521 t_u32 subcmd; 522 /** Set/Get */ 523 t_u32 action; 524 /** domain_param TLV (incl. header) */ 525 t_u8 tlv[]; 526 } domain_info_para; 527 528 /** DOMAIN_INFO param sizes */ 529 #define TLV_HEADER_LEN (2 + 2) 530 #define SUB_BAND_LEN 3 531 #define MAX_SUB_BANDS 40 532 533 /** MAX domain TLV length */ 534 #define MAX_DOMAIN_TLV_LEN \ 535 (TLV_HEADER_LEN + COUNTRY_CODE_LEN + (SUB_BAND_LEN * MAX_SUB_BANDS)) 536 537 /** DOMAIN_INFO param size of dfs_region */ 538 #define DFS_REGION_LEN 1 539 /** MAX reg domain TLV length*/ 540 #define MAX_REG_DOMAIN_TLV_LEN (TLV_HEADER_LEN + DFS_REGION_LEN) 541 542 /** Get/Set channel DFS state */ 543 int woal_11h_chan_dfs_state(moal_private *priv, t_u8 action, 544 mlan_ds_11h_chan_dfs_state *ch_dfs_state); 545 #ifdef UAP_CFG80211 546 #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) 547 void woal_update_channels_dfs_state(moal_private *priv, t_u8 channel, 548 t_u8 bandwidth, t_u8 dfs_state); 549 #endif 550 #endif 551 552 mlan_status woal_set_get_uap_power_mode(moal_private *priv, t_u32 action, 553 mlan_ds_ps_mgmt *ps_mgmt); 554 void woal_uap_set_multicast_list(struct net_device *dev); 555 556 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0) 557 int woal_uap_do_ioctl(struct net_device *dev, struct ifreq *req, 558 void __user *data, int cmd); 559 #else 560 int woal_uap_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd); 561 #endif 562 563 int woal_uap_bss_ctrl(moal_private *priv, t_u8 wait_option, int data); 564 565 int woal_uap_get_channel_nop_info(moal_private *priv, t_u8 wait_option, 566 pmlan_ds_11h_chan_nop_info ch_info); 567 568 mlan_status woal_set_get_ap_channel(moal_private *priv, t_u16 action, 569 t_u8 wait_option, 570 chan_band_info *uap_channel); 571 #ifdef CONFIG_PROC_FS 572 void woal_uap_get_version(moal_private *priv, char *version, int max_len); 573 #endif 574 mlan_status woal_uap_get_stats(moal_private *priv, t_u8 wait_option, 575 pmlan_ds_uap_stats ustats); 576 #if defined(UAP_WEXT) || defined(UAP_CFG80211) 577 extern struct iw_handler_def woal_uap_handler_def; 578 struct iw_statistics *woal_get_uap_wireless_stats(struct net_device *dev); 579 /** IOCTL function for wireless private IOCTLs */ 580 int woal_uap_do_priv_ioctl(struct net_device *dev, struct ifreq *req, int cmd); 581 #endif 582 /** Set invalid data for each member of mlan_uap_bss_param */ 583 void woal_set_sys_config_invalid_data(pmlan_uap_bss_param config); 584 /** Set/Get system configuration parameters */ 585 mlan_status woal_set_get_sys_config(moal_private *priv, t_u16 action, 586 t_u8 wait_option, 587 mlan_uap_bss_param *sys_cfg); 588 /** Set get AP wmm parameter */ 589 mlan_status woal_set_get_ap_wmm_para(moal_private *priv, t_u16 action, 590 wmm_parameter_t *ap_wmm_para); 591 int woal_uap_set_ap_cfg(moal_private *priv, t_u8 *data, int len); 592 593 int woal_uap_set_11ac_status(moal_private *priv, t_u8 action, t_u8 vht20_40, 594 IEEEtypes_VHTCap_t *vhtcap_ie); 595 int woal_11ax_cfg(moal_private *priv, t_u8 action, mlan_ds_11ax_he_cfg *he_cfg); 596 int woal_uap_set_11ax_status(moal_private *priv, t_u8 action, t_u8 band, 597 IEEEtypes_HECap_t *hecap_ie); 598 int woal_set_uap_ht_tx_cfg(moal_private *priv, Band_Config_t bandcfg, 599 t_u16 ht_cap, t_u8 en); 600 mlan_status woal_uap_set_11n_status(moal_private *priv, 601 mlan_uap_bss_param *sys_cfg, t_u8 action); 602 #ifdef UAP_WEXT 603 void woal_ioctl_get_uap_info_resp(moal_private *priv, pmlan_ds_get_info info); 604 int woal_set_get_custom_ie(moal_private *priv, t_u16 mask, t_u8 *ie, 605 int ie_len); 606 #endif /* UAP_WEXT */ 607 608 #endif /* _MOAL_UAP_H */ 609