1 /****************************************************************************** 2 * 3 * Copyright(c) 2007 - 2017 Realtek Corporation. 4 * 5 * This program is free software; you can redistribute it and/or modify it 6 * under the terms of version 2 of the GNU General Public License as 7 * published by the Free Software Foundation. 8 * 9 * This program is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 * more details. 13 * 14 *****************************************************************************/ 15 #ifndef __RTW_CMD_H_ 16 #define __RTW_CMD_H_ 17 18 19 #define C2H_MEM_SZ (16*1024) 20 21 #define FREE_CMDOBJ_SZ 128 22 23 #define MAX_CMDSZ 1536 24 #define MAX_RSPSZ 512 25 #define MAX_EVTSZ 1024 26 27 #define CMDBUFF_ALIGN_SZ 512 28 29 struct cmd_obj { 30 _adapter *padapter; 31 u16 cmdcode; 32 u8 res; 33 u8 *parmbuf; 34 u32 cmdsz; 35 u8 *rsp; 36 u32 rspsz; 37 struct submit_ctx *sctx; 38 u8 no_io; 39 /* _sema cmd_sem; */ 40 _list list; 41 }; 42 43 /* cmd flags */ 44 enum { 45 RTW_CMDF_DIRECTLY = BIT0, 46 RTW_CMDF_WAIT_ACK = BIT1, 47 }; 48 49 struct cmd_priv { 50 _sema cmd_queue_sema; 51 /* _sema cmd_done_sema; */ 52 _sema start_cmdthread_sema; 53 54 _queue cmd_queue; 55 u8 cmd_seq; 56 u8 *cmd_buf; /* shall be non-paged, and 4 bytes aligned */ 57 u8 *cmd_allocated_buf; 58 u8 *rsp_buf; /* shall be non-paged, and 4 bytes aligned */ 59 u8 *rsp_allocated_buf; 60 u32 cmd_issued_cnt; 61 u32 cmd_done_cnt; 62 u32 rsp_cnt; 63 ATOMIC_T cmdthd_running; 64 /* u8 cmdthd_running; */ 65 66 _adapter *padapter; 67 _mutex sctx_mutex; 68 }; 69 70 #ifdef CONFIG_EVENT_THREAD_MODE 71 struct evt_obj { 72 u16 evtcode; 73 u8 res; 74 u8 *parmbuf; 75 u32 evtsz; 76 _list list; 77 }; 78 #endif 79 80 struct evt_priv { 81 #ifdef CONFIG_EVENT_THREAD_MODE 82 _sema evt_notify; 83 84 _queue evt_queue; 85 #endif 86 87 #ifdef CONFIG_FW_C2H_REG 88 #define CONFIG_C2H_WK 89 #endif 90 91 #ifdef CONFIG_C2H_WK 92 _workitem c2h_wk; 93 bool c2h_wk_alive; 94 struct rtw_cbuf *c2h_queue; 95 #define C2H_QUEUE_MAX_LEN 10 96 #endif 97 98 #ifdef CONFIG_H2CLBK 99 _sema lbkevt_done; 100 u8 lbkevt_limit; 101 u8 lbkevt_num; 102 u8 *cmdevt_parm; 103 #endif 104 ATOMIC_T event_seq; 105 u8 *evt_buf; /* shall be non-paged, and 4 bytes aligned */ 106 u8 *evt_allocated_buf; 107 u32 evt_done_cnt; 108 #if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) 109 u8 *c2h_mem; 110 u8 *allocated_c2h_mem; 111 #endif 112 113 }; 114 115 #define init_h2fwcmd_w_parm_no_rsp(pcmd, pparm, code) \ 116 do {\ 117 _rtw_init_listhead(&pcmd->list);\ 118 pcmd->cmdcode = code;\ 119 pcmd->parmbuf = (u8 *)(pparm);\ 120 pcmd->cmdsz = sizeof (*pparm);\ 121 pcmd->rsp = NULL;\ 122 pcmd->rspsz = 0;\ 123 } while (0) 124 125 #define init_h2fwcmd_w_parm_no_parm_rsp(pcmd, code) \ 126 do {\ 127 _rtw_init_listhead(&pcmd->list);\ 128 pcmd->cmdcode = code;\ 129 pcmd->parmbuf = NULL;\ 130 pcmd->cmdsz = 0;\ 131 pcmd->rsp = NULL;\ 132 pcmd->rspsz = 0;\ 133 } while (0) 134 135 struct P2P_PS_Offload_t { 136 u8 Offload_En:1; 137 u8 role:1; /* 1: Owner, 0: Client */ 138 u8 CTWindow_En:1; 139 u8 NoA0_En:1; 140 u8 NoA1_En:1; 141 u8 AllStaSleep:1; /* Only valid in Owner */ 142 u8 discovery:1; 143 u8 rsvd:1; 144 #ifdef CONFIG_P2P_PS_NOA_USE_MACID_SLEEP 145 u8 p2p_macid:7; 146 u8 disable_close_rf:1; /*1: not close RF but just pause p2p_macid when NoA duration*/ 147 #endif /* CONFIG_P2P_PS_NOA_USE_MACID_SLEEP */ 148 }; 149 150 struct P2P_PS_CTWPeriod_t { 151 u8 CTWPeriod; /* TU */ 152 }; 153 154 #ifdef CONFIG_P2P_WOWLAN 155 156 struct P2P_WoWlan_Offload_t { 157 u8 Disconnect_Wkup_Drv:1; 158 u8 role:2; 159 u8 Wps_Config[2]; 160 }; 161 162 #endif /* CONFIG_P2P_WOWLAN */ 163 164 extern u32 rtw_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *obj); 165 extern struct cmd_obj *rtw_dequeue_cmd(struct cmd_priv *pcmdpriv); 166 extern void rtw_free_cmd_obj(struct cmd_obj *pcmd); 167 168 #ifdef CONFIG_EVENT_THREAD_MODE 169 extern u32 rtw_enqueue_evt(struct evt_priv *pevtpriv, struct evt_obj *obj); 170 extern struct evt_obj *rtw_dequeue_evt(_queue *queue); 171 extern void rtw_free_evt_obj(struct evt_obj *pcmd); 172 #endif 173 174 void rtw_stop_cmd_thread(_adapter *adapter); 175 thread_return rtw_cmd_thread(thread_context context); 176 177 extern u32 rtw_init_cmd_priv(struct cmd_priv *pcmdpriv); 178 extern void rtw_free_cmd_priv(struct cmd_priv *pcmdpriv); 179 180 extern u32 rtw_init_evt_priv(struct evt_priv *pevtpriv); 181 extern void rtw_free_evt_priv(struct evt_priv *pevtpriv); 182 extern void rtw_cmd_clr_isr(struct cmd_priv *pcmdpriv); 183 extern void rtw_evt_notify_isr(struct evt_priv *pevtpriv); 184 #ifdef CONFIG_P2P 185 u8 p2p_protocol_wk_cmd(_adapter *padapter, int intCmdType); 186 #endif /* CONFIG_P2P */ 187 188 #ifdef CONFIG_IOCTL_CFG80211 189 struct rtw_roch_parm { 190 u64 cookie; 191 struct wireless_dev *wdev; 192 struct ieee80211_channel ch; 193 enum nl80211_channel_type ch_type; 194 unsigned int duration; 195 }; 196 197 u8 rtw_roch_cmd(_adapter *adapter 198 , u64 cookie, struct wireless_dev *wdev 199 , struct ieee80211_channel *ch, enum nl80211_channel_type ch_type 200 , unsigned int duration 201 , u8 flags 202 ); 203 204 u8 rtw_cancel_roch_cmd(_adapter *adapter, u64 cookie, struct wireless_dev *wdev, u8 flags); 205 206 u8 rtw_mgnt_tx_cmd(_adapter *adapter, u8 tx_ch, u8 no_cck, const u8 *buf, size_t len, int wait_ack, u8 flags); 207 struct mgnt_tx_parm { 208 u8 tx_ch; 209 u8 no_cck; 210 const u8 *buf; 211 size_t len; 212 int wait_ack; 213 }; 214 #endif 215 216 enum rtw_drvextra_cmd_id { 217 NONE_WK_CID, 218 STA_MSTATUS_RPT_WK_CID, 219 DYNAMIC_CHK_WK_CID, 220 DM_CTRL_WK_CID, 221 PBC_POLLING_WK_CID, 222 POWER_SAVING_CTRL_WK_CID,/* IPS,AUTOSuspend */ 223 LPS_CTRL_WK_CID, 224 ANT_SELECT_WK_CID, 225 P2P_PS_WK_CID, 226 P2P_PROTO_WK_CID, 227 CHECK_HIQ_WK_CID,/* for softap mode, check hi queue if empty */ 228 C2H_WK_CID, 229 RTP_TIMER_CFG_WK_CID, 230 RESET_SECURITYPRIV, /* add for CONFIG_IEEE80211W, none 11w also can use */ 231 FREE_ASSOC_RESOURCES, /* add for CONFIG_IEEE80211W, none 11w also can use */ 232 DM_IN_LPS_WK_CID, 233 DM_RA_MSK_WK_CID, /* add for STA update RAMask when bandwith change. */ 234 BEAMFORMING_WK_CID, 235 LPS_CHANGE_DTIM_CID, 236 BTINFO_WK_CID, 237 BTC_REDUCE_WL_TXPWR_CID, 238 DFS_RADAR_DETECT_WK_CID, 239 DFS_RADAR_DETECT_EN_DEC_WK_CID, 240 SESSION_TRACKER_WK_CID, 241 EN_HW_UPDATE_TSF_WK_CID, 242 PERIOD_TSF_UPDATE_END_WK_CID, 243 TEST_H2C_CID, 244 MP_CMD_WK_CID, 245 CUSTOMER_STR_WK_CID, 246 #ifdef CONFIG_RTW_REPEATER_SON 247 RSON_SCAN_WK_CID, 248 #endif 249 ROCH_WK_CID, 250 MGNT_TX_WK_CID, 251 REQ_PER_CMD_WK_CID, 252 SSMPS_WK_CID, 253 #ifdef CONFIG_CTRL_TXSS_BY_TP 254 TXSS_WK_CID, 255 #endif 256 AC_PARM_CMD_WK_CID, 257 #ifdef CONFIG_AP_MODE 258 STOP_AP_WK_CID, 259 #endif 260 #ifdef CONFIG_RTW_TOKEN_BASED_XMIT 261 TBTX_CONTROL_TX_WK_CID, 262 #endif 263 MAX_WK_CID 264 }; 265 266 enum LPS_CTRL_TYPE { 267 LPS_CTRL_SCAN = 0, 268 LPS_CTRL_JOINBSS = 1, 269 LPS_CTRL_CONNECT = 2, 270 LPS_CTRL_DISCONNECT = 3, 271 LPS_CTRL_SPECIAL_PACKET = 4, 272 LPS_CTRL_LEAVE = 5, 273 LPS_CTRL_TRAFFIC_BUSY = 6, 274 LPS_CTRL_TX_TRAFFIC_LEAVE = 7, 275 LPS_CTRL_RX_TRAFFIC_LEAVE = 8, 276 LPS_CTRL_ENTER = 9, 277 LPS_CTRL_LEAVE_CFG80211_PWRMGMT = 10, 278 LPS_CTRL_LEAVE_SET_OPTION = 11, 279 }; 280 281 enum STAKEY_TYPE { 282 GROUP_KEY = 0, 283 UNICAST_KEY = 1, 284 TDLS_KEY = 2, 285 }; 286 287 enum RFINTFS { 288 SWSI, 289 HWSI, 290 HWPI, 291 }; 292 293 294 /* 295 Caller Mode: Infra, Ad-Hoc 296 297 Notes: To join the specified bss 298 299 Command Event Mode 300 301 */ 302 struct joinbss_parm { 303 WLAN_BSSID_EX network; 304 }; 305 306 /* 307 Caller Mode: Infra, Ad-HoC(C) 308 309 Notes: To disconnect the current associated BSS 310 311 Command Mode 312 313 */ 314 struct disconnect_parm { 315 u32 deauth_timeout_ms; 316 }; 317 318 /* 319 Caller Mode: AP, Ad-HoC(M) 320 321 Notes: To create a BSS 322 323 Command Mode 324 */ 325 struct createbss_parm { 326 bool adhoc; 327 328 /* used by AP/Mesh mode now */ 329 u8 ifbmp; 330 u8 excl_ifbmp; 331 s16 req_ch; 332 s8 req_bw; 333 s8 req_offset; 334 }; 335 336 337 struct setopmode_parm { 338 u8 mode; 339 u8 rsvd[3]; 340 }; 341 342 /* 343 Caller Mode: AP, Ad-HoC, Infra 344 345 Notes: To ask RTL8711 performing site-survey 346 347 Command-Event Mode 348 349 */ 350 351 #define RTW_SSID_SCAN_AMOUNT 9 /* for WEXT_CSCAN_AMOUNT 9 */ 352 #define RTW_CHANNEL_SCAN_AMOUNT (14+37) 353 struct sitesurvey_parm { 354 sint scan_mode; /* active: 1, passive: 0 */ 355 /* sint bsslimit; // 1 ~ 48 */ 356 u8 ssid_num; 357 u8 ch_num; 358 NDIS_802_11_SSID ssid[RTW_SSID_SCAN_AMOUNT]; 359 struct rtw_ieee80211_channel ch[RTW_CHANNEL_SCAN_AMOUNT]; 360 361 u32 token; /* 80211k use it to identify caller */ 362 u16 duration; /* 0: use default, otherwise: channel scan time */ 363 u8 igi; /* 0: use defalut */ 364 u8 bw; /* 0: use default */ 365 366 bool acs; /* aim to trigger channel selection when scan done */ 367 u8 reason; 368 }; 369 370 /* 371 Caller Mode: Any 372 373 Notes: To set the auth type of RTL8711. open/shared/802.1x 374 375 Command Mode 376 377 */ 378 struct setauth_parm { 379 u8 mode; /* 0: legacy open, 1: legacy shared 2: 802.1x */ 380 u8 _1x; /* 0: PSK, 1: TLS */ 381 u8 rsvd[2]; 382 }; 383 384 /* 385 Caller Mode: Infra 386 387 a. algorithm: wep40, wep104, tkip & aes 388 b. keytype: grp key/unicast key 389 c. key contents 390 391 when shared key ==> keyid is the camid 392 when 802.1x ==> keyid [0:1] ==> grp key 393 when 802.1x ==> keyid > 2 ==> unicast key 394 395 */ 396 struct setkey_parm { 397 u8 algorithm; /* encryption algorithm, could be none, wep40, TKIP, CCMP, wep104 */ 398 u8 keyid; 399 u8 set_tx; /* 1: main tx key for wep. 0: other key. */ 400 u8 key[32]; /* this could be 40 or 104 */ 401 }; 402 403 /* 404 When in AP or Ad-Hoc mode, this is used to 405 allocate an sw/hw entry for a newly associated sta. 406 407 Command 408 409 when shared key ==> algorithm/keyid 410 411 */ 412 struct set_stakey_parm { 413 u8 addr[ETH_ALEN]; 414 u8 algorithm; 415 u8 keyid; 416 u8 key[32]; 417 u8 gk; 418 }; 419 420 struct set_stakey_rsp { 421 u8 addr[ETH_ALEN]; 422 u8 keyid; 423 u8 rsvd; 424 }; 425 426 struct Tx_Beacon_param { 427 WLAN_BSSID_EX network; 428 }; 429 430 /* 431 Notes: This command is used for H2C/C2H loopback testing 432 433 mac[0] == 0 434 ==> CMD mode, return H2C_SUCCESS. 435 The following condition must be ture under CMD mode 436 mac[1] == mac[4], mac[2] == mac[3], mac[0]=mac[5]= 0; 437 s0 == 0x1234, s1 == 0xabcd, w0 == 0x78563412, w1 == 0x5aa5def7; 438 s2 == (b1 << 8 | b0); 439 440 mac[0] == 1 441 ==> CMD_RSP mode, return H2C_SUCCESS_RSP 442 443 The rsp layout shall be: 444 rsp: parm: 445 mac[0] = mac[5]; 446 mac[1] = mac[4]; 447 mac[2] = mac[3]; 448 mac[3] = mac[2]; 449 mac[4] = mac[1]; 450 mac[5] = mac[0]; 451 s0 = s1; 452 s1 = swap16(s0); 453 w0 = swap32(w1); 454 b0 = b1 455 s2 = s0 + s1 456 b1 = b0 457 w1 = w0 458 459 mac[0] == 2 460 ==> CMD_EVENT mode, return H2C_SUCCESS 461 The event layout shall be: 462 event: parm: 463 mac[0] = mac[5]; 464 mac[1] = mac[4]; 465 mac[2] = event's sequence number, starting from 1 to parm's marc[3] 466 mac[3] = mac[2]; 467 mac[4] = mac[1]; 468 mac[5] = mac[0]; 469 s0 = swap16(s0) - event.mac[2]; 470 s1 = s1 + event.mac[2]; 471 w0 = swap32(w0); 472 b0 = b1 473 s2 = s0 + event.mac[2] 474 b1 = b0 475 w1 = swap32(w1) - event.mac[2]; 476 477 parm->mac[3] is the total event counts that host requested. 478 479 480 event will be the same with the cmd's param. 481 482 */ 483 484 #ifdef CONFIG_H2CLBK 485 486 struct seth2clbk_parm { 487 u8 mac[6]; 488 u16 s0; 489 u16 s1; 490 u32 w0; 491 u8 b0; 492 u16 s2; 493 u8 b1; 494 u32 w1; 495 }; 496 497 struct geth2clbk_parm { 498 u32 rsv; 499 }; 500 501 struct geth2clbk_rsp { 502 u8 mac[6]; 503 u16 s0; 504 u16 s1; 505 u32 w0; 506 u8 b0; 507 u16 s2; 508 u8 b1; 509 u32 w1; 510 }; 511 512 #endif /* CONFIG_H2CLBK */ 513 514 /* CMD param Formart for driver extra cmd handler */ 515 struct drvextra_cmd_parm { 516 int ec_id; /* extra cmd id */ 517 int type; /* Can use this field as the type id or command size */ 518 int size; /* buffer size */ 519 unsigned char *pbuf; 520 }; 521 522 /*------------------- Below are used for RF/BB tunning ---------------------*/ 523 struct addBaReq_parm { 524 unsigned int tid; 525 u8 addr[ETH_ALEN]; 526 }; 527 528 struct addBaRsp_parm { 529 unsigned int tid; 530 unsigned int start_seq; 531 u8 addr[ETH_ALEN]; 532 u8 status; 533 u8 size; 534 }; 535 536 struct set_ch_parm { 537 u8 ch; 538 u8 bw; 539 u8 ch_offset; 540 }; 541 542 struct SetChannelPlan_param { 543 enum regd_src_t regd_src; 544 const struct country_chplan *country_ent; 545 u8 channel_plan; 546 }; 547 548 struct get_channel_plan_param { 549 struct get_chplan_resp **resp; 550 }; 551 552 struct LedBlink_param { 553 void *pLed; 554 }; 555 556 struct TDLSoption_param { 557 u8 addr[ETH_ALEN]; 558 u8 option; 559 }; 560 561 struct RunInThread_param { 562 void (*func)(void *); 563 void *context; 564 }; 565 566 #ifdef CONFIG_WRITE_BCN_LEN_TO_FW 567 struct write_bcnlen_param { 568 u16 bcn_len; 569 }; 570 #endif 571 572 #define GEN_CMD_CODE(cmd) cmd ## _CMD_ 573 574 575 /* 576 577 Result: 578 0x00: success 579 0x01: sucess, and check Response. 580 0x02: cmd ignored due to duplicated sequcne number 581 0x03: cmd dropped due to invalid cmd code 582 0x04: reserved. 583 584 */ 585 586 #define H2C_RSP_OFFSET 512 587 588 #define H2C_SUCCESS 0x00 589 #define H2C_SUCCESS_RSP 0x01 590 #define H2C_DUPLICATED 0x02 591 #define H2C_DROPPED 0x03 592 #define H2C_PARAMETERS_ERROR 0x04 593 #define H2C_REJECTED 0x05 594 #define H2C_CMD_OVERFLOW 0x06 595 #define H2C_RESERVED 0x07 596 #define H2C_ENQ_HEAD 0x08 597 #define H2C_ENQ_HEAD_FAIL 0x09 598 #define H2C_CMD_FAIL 0x0A 599 600 void rtw_init_sitesurvey_parm(_adapter *padapter, struct sitesurvey_parm *pparm); 601 u8 rtw_sitesurvey_cmd(_adapter *padapter, struct sitesurvey_parm *pparm); 602 #ifdef CONFIG_AP_MODE 603 u8 rtw_create_ibss_cmd(_adapter *adapter, int flags); 604 u8 rtw_startbss_cmd(_adapter *adapter, int flags); 605 #endif 606 607 #define REQ_CH_NONE -1 608 #define REQ_CH_INT_INFO -2 609 #define REQ_BW_NONE -1 610 #define REQ_BW_ORI -2 611 #define REQ_OFFSET_NONE -1 612 613 struct sta_info; 614 extern u8 rtw_setstakey_cmd(_adapter *padapter, struct sta_info *sta, u8 key_type, bool enqueue); 615 extern u8 rtw_clearstakey_cmd(_adapter *padapter, struct sta_info *sta, u8 enqueue); 616 617 extern u8 rtw_joinbss_cmd(_adapter *padapter, struct wlan_network *pnetwork); 618 u8 rtw_disassoc_cmd(_adapter *padapter, u32 deauth_timeout_ms, int flags); 619 #ifdef CONFIG_AP_MODE 620 u8 rtw_change_bss_chbw_cmd(_adapter *adapter, int flags 621 , u8 ifbmp, u8 excl_ifbmp, s16 req_ch, s8 req_bw, s8 req_offset); 622 u8 rtw_stop_ap_cmd(_adapter *adapter, u8 flags); 623 #endif 624 #ifdef CONFIG_RTW_TOKEN_BASED_XMIT 625 u8 rtw_tx_control_cmd(_adapter *adapter); 626 #endif 627 extern u8 rtw_setopmode_cmd(_adapter *padapter, NDIS_802_11_NETWORK_INFRASTRUCTURE networktype, u8 flags); 628 629 extern u8 rtw_addbareq_cmd(_adapter *padapter, u8 tid, u8 *addr); 630 extern u8 rtw_addbarsp_cmd(_adapter *padapter, u8 *addr, u16 tid, u8 status, u8 size, u16 start_seq); 631 /* add for CONFIG_IEEE80211W, none 11w also can use */ 632 extern u8 rtw_reset_securitypriv_cmd(_adapter *padapter); 633 extern u8 rtw_free_assoc_resources_cmd(_adapter *padapter, u8 lock_scanned_queue, int flags); 634 extern u8 rtw_dynamic_chk_wk_cmd(_adapter *adapter); 635 636 u8 rtw_lps_ctrl_wk_cmd(_adapter *padapter, u8 lps_ctrl_type, u8 flags); 637 u8 rtw_lps_ctrl_leave_set_level_cmd(_adapter *adapter, u8 lps_level, u8 flags); 638 #ifdef CONFIG_LPS_1T1R 639 u8 rtw_lps_ctrl_leave_set_1t1r_cmd(_adapter *adapter, u8 lps_1t1r, u8 flags); 640 #endif 641 u8 rtw_dm_in_lps_wk_cmd(_adapter *padapter); 642 u8 rtw_lps_change_dtim_cmd(_adapter *padapter, u8 dtim); 643 644 #if (RATE_ADAPTIVE_SUPPORT == 1) 645 u8 rtw_rpt_timer_cfg_cmd(_adapter *padapter, u16 minRptTime); 646 #endif 647 648 #ifdef CONFIG_ANTENNA_DIVERSITY 649 extern u8 rtw_antenna_select_cmd(_adapter *padapter, u8 antenna, u8 enqueue); 650 #endif 651 652 u8 rtw_dm_ra_mask_wk_cmd(_adapter *padapter, u8 *psta); 653 654 extern u8 rtw_ps_cmd(_adapter *padapter); 655 656 #if CONFIG_DFS 657 void rtw_dfs_ch_switch_hdl(struct dvobj_priv *dvobj); 658 #endif 659 660 #ifdef CONFIG_AP_MODE 661 u8 rtw_chk_hi_queue_cmd(_adapter *padapter); 662 #ifdef CONFIG_DFS_MASTER 663 u8 rtw_dfs_rd_cmd(_adapter *adapter, bool enqueue); 664 void rtw_dfs_rd_timer_hdl(void *ctx); 665 void rtw_dfs_rd_en_decision(_adapter *adapter, u8 mlme_act, u8 excl_ifbmp); 666 u8 rtw_dfs_rd_en_decision_cmd(_adapter *adapter); 667 #endif /* CONFIG_DFS_MASTER */ 668 #endif /* CONFIG_AP_MODE */ 669 670 #ifdef CONFIG_BT_COEXIST 671 u8 rtw_btinfo_cmd(PADAPTER padapter, u8 *pbuf, u16 length); 672 u8 rtw_btc_reduce_wl_txpwr_cmd(_adapter *adapter, u32 val); 673 #endif 674 675 u8 rtw_test_h2c_cmd(_adapter *adapter, u8 *buf, u8 len); 676 677 u8 rtw_enable_hw_update_tsf_cmd(_adapter *padapter); 678 u8 rtw_periodic_tsf_update_end_cmd(_adapter *adapter); 679 680 u8 rtw_set_chbw_cmd(_adapter *padapter, u8 ch, u8 bw, u8 ch_offset, u8 flags); 681 u8 rtw_iqk_cmd(_adapter *padapter, u8 flags); 682 683 u8 rtw_set_chplan_cmd(_adapter *adapter, int flags, u8 chplan, u8 swconfig); 684 u8 rtw_set_country_cmd(_adapter *adapter, int flags, const char *country_code, u8 swconfig); 685 #ifdef CONFIG_REGD_SRC_FROM_OS 686 u8 rtw_sync_os_regd_cmd(_adapter *adapter, int flags, const char *country_code, u8 dfs_region); 687 #endif 688 u8 rtw_get_chplan_cmd(_adapter *adapter, int flags, struct get_chplan_resp **resp); 689 690 extern u8 rtw_led_blink_cmd(_adapter *padapter, void *pLed); 691 extern u8 rtw_set_csa_cmd(_adapter *adapter); 692 extern u8 rtw_tdls_cmd(_adapter *padapter, u8 *addr, u8 option); 693 694 u8 rtw_mp_cmd(_adapter *adapter, u8 mp_cmd_id, u8 flags); 695 696 #ifdef CONFIG_RTW_CUSTOMER_STR 697 u8 rtw_customer_str_req_cmd(_adapter *adapter); 698 u8 rtw_customer_str_write_cmd(_adapter *adapter, const u8 *cstr); 699 #endif 700 701 #ifdef CONFIG_FW_C2H_REG 702 u8 rtw_c2h_reg_wk_cmd(_adapter *adapter, u8 *c2h_evt); 703 #endif 704 #ifdef CONFIG_FW_C2H_PKT 705 u8 rtw_c2h_packet_wk_cmd(_adapter *adapter, u8 *c2h_evt, u16 length); 706 #endif 707 708 #ifdef CONFIG_RTW_REPEATER_SON 709 #define RSON_SCAN_PROCESS 10 710 #define RSON_SCAN_DISABLE 11 711 u8 rtw_rson_scan_wk_cmd(_adapter *adapter, int op); 712 #endif 713 714 u8 rtw_run_in_thread_cmd(_adapter *adapter, void (*func)(void *), void *context); 715 u8 rtw_run_in_thread_cmd_wait(_adapter *adapter, void (*func)(void *), void *context, s32 timeout_ms); 716 717 struct ssmps_cmd_parm { 718 struct sta_info *sta; 719 u8 smps; 720 }; 721 u8 rtw_ssmps_wk_cmd(_adapter *adapter, struct sta_info *sta, u8 smps, u8 enqueue); 722 723 u8 session_tracker_chk_cmd(_adapter *adapter, struct sta_info *sta); 724 u8 session_tracker_add_cmd(_adapter *adapter, struct sta_info *sta, u8 *local_naddr, u8 *local_port, u8 *remote_naddr, u8 *remote_port); 725 u8 session_tracker_del_cmd(_adapter *adapter, struct sta_info *sta, u8 *local_naddr, u8 *local_port, u8 *remote_naddr, u8 *remote_port); 726 727 u8 set_txq_params_cmd(_adapter *adapter, u32 ac_parm, u8 ac_type); 728 729 #if defined(CONFIG_RTW_MESH) && defined(RTW_PER_CMD_SUPPORT_FW) 730 u8 rtw_req_per_cmd(_adapter * adapter); 731 #endif 732 #ifdef CONFIG_RTW_TOKEN_BASED_XMIT 733 u8 rtw_tbtx_chk_cmd(_adapter *adapter); 734 u8 rtw_tbtx_token_dispatch_cmd(_adapter *adapter); 735 #endif 736 737 #ifdef CONFIG_WRITE_BCN_LEN_TO_FW 738 u8 rtw_write_bcnlen_to_fw_cmd(_adapter *padapter, u16 bcn_len); 739 #endif 740 741 #ifdef CONFIG_CTRL_TXSS_BY_TP 742 struct txss_cmd_parm { 743 struct sta_info *sta; 744 bool tx_1ss; 745 }; 746 747 void rtw_ctrl_txss_update_mimo_type(_adapter *adapter, struct sta_info *sta); 748 u8 rtw_ctrl_txss(_adapter *adapter, struct sta_info *sta, bool tx_1ss); 749 void rtw_ctrl_tx_ss_by_tp(_adapter *adapter, u8 from_timer); 750 751 #ifdef DBG_CTRL_TXSS 752 void dbg_ctrl_txss(_adapter *adapter, bool tx_1ss); 753 #endif 754 #endif 755 756 u8 rtw_drvextra_cmd_hdl(_adapter *padapter, unsigned char *pbuf); 757 758 extern void rtw_survey_cmd_callback(_adapter *padapter, struct cmd_obj *pcmd); 759 extern void rtw_disassoc_cmd_callback(_adapter *padapter, struct cmd_obj *pcmd); 760 extern void rtw_joinbss_cmd_callback(_adapter *padapter, struct cmd_obj *pcmd); 761 void rtw_create_ibss_post_hdl(_adapter *padapter, int status); 762 extern void rtw_readtssi_cmdrsp_callback(_adapter *padapter, struct cmd_obj *pcmd); 763 764 extern void rtw_setstaKey_cmdrsp_callback(_adapter *padapter, struct cmd_obj *pcmd); 765 extern void rtw_getrttbl_cmdrsp_callback(_adapter *padapter, struct cmd_obj *pcmd); 766 767 enum rtw_cmd_id { 768 CMD_JOINBSS, /*0*/ 769 CMD_DISCONNECT, /*1*/ 770 CMD_CREATE_BSS,/*2*/ 771 CMD_SET_OPMODE, /*3*/ 772 CMD_SITE_SURVEY, /*4*/ 773 CMD_SET_AUTH, /*5*/ 774 CMD_SET_KEY, /*6*/ 775 CMD_SET_STAKEY, /*7*/ 776 CMD_ADD_BAREQ, /*8*/ 777 CMD_SET_CHANNEL, /*9*/ 778 CMD_TX_BEACON, /*10*/ 779 CMD_SET_MLME_EVT, /*11*/ 780 CMD_SET_DRV_EXTRA, /*12*/ 781 CMD_SET_CHANPLAN, /*13*/ 782 CMD_LEDBLINK, /*14*/ 783 CMD_SET_CHANSWITCH, /*15*/ 784 CMD_TDLS, /*16*/ 785 CMD_CHK_BMCSLEEPQ, /*17*/ 786 CMD_RUN_INTHREAD, /*18*/ 787 CMD_ADD_BARSP, /*19*/ 788 CMD_RM_POST_EVENT, /*20*/ 789 CMD_SET_MESH_PLINK_STATE, /* 21 */ 790 CMD_DO_IQK, /* 22 */ 791 CMD_GET_CHANPLAN, /*23*/ 792 CMD_WRITE_BCN_LEN, /*24 */ 793 CMD_ID_MAX 794 }; 795 796 #define CMD_FMT "cmd=%d,%d,%d" 797 #define CMD_ARG(cmd) \ 798 (cmd)->cmdcode, \ 799 (cmd)->cmdcode == CMD_SET_DRV_EXTRA ? ((struct drvextra_cmd_parm *)(cmd)->parmbuf)->ec_id : ((cmd)->cmdcode == CMD_SET_MLME_EVT ? ((struct rtw_evt_header *)(cmd)->parmbuf)->id : 0), \ 800 (cmd)->cmdcode == CMD_SET_DRV_EXTRA ? ((struct drvextra_cmd_parm *)(cmd)->parmbuf)->type : 0 801 802 #endif /* _CMD_H_ */ 803