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 enum rtw_regd_inr inr; 545 struct country_chplan country_ent; 546 bool has_country; 547 u8 channel_plan; 548 #if CONFIG_IEEE80211_BAND_6GHZ 549 u8 channel_plan_6g; 550 #endif 551 552 #ifdef CONFIG_80211D 553 /* used for regd_src == RTK_PRIV and inr == COUNTRY_IE */ 554 struct country_ie_slave_record cisr; 555 bool has_cisr; 556 #endif 557 558 #ifdef PLATFORM_LINUX 559 bool rtnl_lock_needed; 560 #endif 561 }; 562 563 struct get_channel_plan_param { 564 struct get_chplan_resp **chplan; 565 }; 566 567 struct LedBlink_param { 568 void *pLed; 569 }; 570 571 struct TDLSoption_param { 572 u8 addr[ETH_ALEN]; 573 u8 option; 574 }; 575 576 struct RunInThread_param { 577 void (*func)(void *); 578 void *context; 579 }; 580 581 #ifdef CONFIG_WRITE_BCN_LEN_TO_FW 582 struct write_bcnlen_param { 583 u16 bcn_len; 584 }; 585 #endif 586 587 struct reqtxrpt_param { 588 u8 macid; 589 }; 590 591 #define GEN_CMD_CODE(cmd) cmd ## _CMD_ 592 593 594 /* 595 596 Result: 597 0x00: success 598 0x01: sucess, and check Response. 599 0x02: cmd ignored due to duplicated sequcne number 600 0x03: cmd dropped due to invalid cmd code 601 0x04: reserved. 602 603 */ 604 605 #define H2C_RSP_OFFSET 512 606 607 #define H2C_SUCCESS 0x00 608 #define H2C_SUCCESS_RSP 0x01 609 #define H2C_DUPLICATED 0x02 610 #define H2C_DROPPED 0x03 611 #define H2C_PARAMETERS_ERROR 0x04 612 #define H2C_REJECTED 0x05 613 #define H2C_CMD_OVERFLOW 0x06 614 #define H2C_RESERVED 0x07 615 #define H2C_ENQ_HEAD 0x08 616 #define H2C_ENQ_HEAD_FAIL 0x09 617 #define H2C_CMD_FAIL 0x0A 618 619 void rtw_init_sitesurvey_parm(_adapter *padapter, struct sitesurvey_parm *pparm); 620 u8 rtw_sitesurvey_cmd(_adapter *padapter, struct sitesurvey_parm *pparm); 621 #ifdef CONFIG_AP_MODE 622 u8 rtw_create_ibss_cmd(_adapter *adapter, int flags); 623 u8 rtw_startbss_cmd(_adapter *adapter, int flags); 624 #endif 625 626 #define REQ_CH_NONE -1 627 #define REQ_CH_INT_INFO -2 628 #define REQ_BW_NONE -1 629 #define REQ_BW_ORI -2 630 #define REQ_OFFSET_NONE -1 631 632 struct sta_info; 633 extern u8 rtw_setstakey_cmd(_adapter *padapter, struct sta_info *sta, u8 key_type, bool enqueue); 634 extern u8 rtw_clearstakey_cmd(_adapter *padapter, struct sta_info *sta, u8 enqueue); 635 636 extern u8 rtw_joinbss_cmd(_adapter *padapter, struct wlan_network *pnetwork); 637 u8 rtw_disassoc_cmd(_adapter *padapter, u32 deauth_timeout_ms, int flags); 638 #ifdef CONFIG_AP_MODE 639 u8 rtw_change_bss_chbw_cmd(_adapter *adapter, int flags 640 , u8 ifbmp, u8 excl_ifbmp, s16 req_ch, s8 req_bw, s8 req_offset); 641 u8 rtw_stop_ap_cmd(_adapter *adapter, u8 flags); 642 #endif 643 #ifdef CONFIG_RTW_TOKEN_BASED_XMIT 644 u8 rtw_tx_control_cmd(_adapter *adapter); 645 #endif 646 extern u8 rtw_setopmode_cmd(_adapter *padapter, NDIS_802_11_NETWORK_INFRASTRUCTURE networktype, u8 flags); 647 648 extern u8 rtw_addbareq_cmd(_adapter *padapter, u8 tid, u8 *addr); 649 extern u8 rtw_addbarsp_cmd(_adapter *padapter, u8 *addr, u16 tid, u8 status, u8 size, u16 start_seq); 650 /* add for CONFIG_IEEE80211W, none 11w also can use */ 651 extern u8 rtw_reset_securitypriv_cmd(_adapter *padapter); 652 extern u8 rtw_free_assoc_resources_cmd(_adapter *padapter, u8 lock_scanned_queue, int flags); 653 extern u8 rtw_dynamic_chk_wk_cmd(_adapter *adapter); 654 655 u8 rtw_lps_ctrl_wk_cmd(_adapter *padapter, u8 lps_ctrl_type, u8 flags); 656 u8 rtw_lps_ctrl_leave_set_level_cmd(_adapter *adapter, u8 lps_level, u8 flags); 657 #ifdef CONFIG_LPS_1T1R 658 u8 rtw_lps_ctrl_leave_set_1t1r_cmd(_adapter *adapter, u8 lps_1t1r, u8 flags); 659 #endif 660 u8 rtw_dm_in_lps_wk_cmd(_adapter *padapter); 661 u8 rtw_lps_change_dtim_cmd(_adapter *padapter, u8 dtim); 662 663 #if (RATE_ADAPTIVE_SUPPORT == 1) 664 u8 rtw_rpt_timer_cfg_cmd(_adapter *padapter, u16 minRptTime); 665 #endif 666 667 #ifdef CONFIG_ANTENNA_DIVERSITY 668 extern u8 rtw_antenna_select_cmd(_adapter *padapter, u8 antenna, u8 enqueue); 669 #endif 670 671 u8 rtw_dm_ra_mask_wk_cmd(_adapter *padapter, u8 *psta); 672 673 extern u8 rtw_ps_cmd(_adapter *padapter); 674 675 #if CONFIG_DFS 676 void rtw_dfs_ch_switch_hdl(struct dvobj_priv *dvobj); 677 #endif 678 679 #ifdef CONFIG_AP_MODE 680 u8 rtw_chk_hi_queue_cmd(_adapter *padapter); 681 #ifdef CONFIG_DFS_MASTER 682 u8 rtw_dfs_rd_cmd(_adapter *adapter, bool enqueue); 683 void rtw_dfs_rd_timer_hdl(void *ctx); 684 void rtw_dfs_rd_en_decision(_adapter *adapter, u8 mlme_act, u8 excl_ifbmp); 685 u8 rtw_dfs_rd_en_decision_cmd(_adapter *adapter); 686 #endif /* CONFIG_DFS_MASTER */ 687 #endif /* CONFIG_AP_MODE */ 688 689 #ifdef CONFIG_BT_COEXIST 690 u8 rtw_btinfo_cmd(PADAPTER padapter, u8 *pbuf, u16 length); 691 u8 rtw_btc_reduce_wl_txpwr_cmd(_adapter *adapter, u32 val); 692 #endif 693 694 u8 rtw_test_h2c_cmd(_adapter *adapter, u8 *buf, u8 len); 695 696 u8 rtw_enable_hw_update_tsf_cmd(_adapter *padapter); 697 u8 rtw_periodic_tsf_update_end_cmd(_adapter *adapter); 698 699 u8 rtw_set_chbw_cmd(_adapter *padapter, u8 ch, u8 bw, u8 ch_offset, u8 flags); 700 u8 rtw_iqk_cmd(_adapter *padapter, u8 flags); 701 702 u8 rtw_set_chplan_cmd(_adapter *adapter, int flags, u8 chplan, u8 chplan_6g, enum rtw_regd_inr inr); 703 u8 rtw_set_country_cmd(_adapter *adapter, int flags, const char *country_code, enum rtw_regd_inr inr); 704 #ifdef CONFIG_REGD_SRC_FROM_OS 705 u8 rtw_sync_os_regd_cmd(_adapter *adapter, int flags, const char *country_code, u8 dfs_region, enum rtw_regd_inr inr); 706 #endif 707 u8 rtw_get_chplan_cmd(_adapter *adapter, int flags, struct get_chplan_resp **chplan); 708 709 #ifdef CONFIG_80211D 710 u8 rtw_apply_recv_country_ie_cmd(_adapter *adapter, int flags, BAND_TYPE band,u8 opch, const u8 *country_ie); 711 #endif 712 713 extern u8 rtw_led_blink_cmd(_adapter *padapter, void *pLed); 714 extern u8 rtw_set_csa_cmd(_adapter *adapter); 715 extern u8 rtw_set_ap_csa_cmd(_adapter *adapter); 716 extern u8 rtw_tdls_cmd(_adapter *padapter, u8 *addr, u8 option); 717 718 u8 rtw_mp_cmd(_adapter *adapter, u8 mp_cmd_id, u8 flags); 719 720 #ifdef CONFIG_RTW_CUSTOMER_STR 721 u8 rtw_customer_str_req_cmd(_adapter *adapter); 722 u8 rtw_customer_str_write_cmd(_adapter *adapter, const u8 *cstr); 723 #endif 724 725 #ifdef CONFIG_FW_C2H_REG 726 u8 rtw_c2h_reg_wk_cmd(_adapter *adapter, u8 *c2h_evt); 727 #endif 728 #ifdef CONFIG_FW_C2H_PKT 729 u8 rtw_c2h_packet_wk_cmd(_adapter *adapter, u8 *c2h_evt, u16 length); 730 #endif 731 732 #ifdef CONFIG_RTW_REPEATER_SON 733 #define RSON_SCAN_PROCESS 10 734 #define RSON_SCAN_DISABLE 11 735 u8 rtw_rson_scan_wk_cmd(_adapter *adapter, int op); 736 #endif 737 738 u8 rtw_run_in_thread_cmd(_adapter *adapter, void (*func)(void *), void *context); 739 u8 rtw_run_in_thread_cmd_wait(_adapter *adapter, void (*func)(void *), void *context, s32 timeout_ms); 740 741 struct ssmps_cmd_parm { 742 struct sta_info *sta; 743 u8 smps; 744 }; 745 u8 rtw_ssmps_wk_cmd(_adapter *adapter, struct sta_info *sta, u8 smps, u8 enqueue); 746 747 u8 session_tracker_chk_cmd(_adapter *adapter, struct sta_info *sta); 748 u8 session_tracker_add_cmd(_adapter *adapter, struct sta_info *sta, u8 *local_naddr, u8 *local_port, u8 *remote_naddr, u8 *remote_port); 749 u8 session_tracker_del_cmd(_adapter *adapter, struct sta_info *sta, u8 *local_naddr, u8 *local_port, u8 *remote_naddr, u8 *remote_port); 750 751 u8 set_txq_params_cmd(_adapter *adapter, u32 ac_parm, u8 ac_type); 752 753 #if defined(CONFIG_RTW_MESH) && defined(RTW_PER_CMD_SUPPORT_FW) 754 u8 rtw_req_per_cmd(_adapter * adapter); 755 #endif 756 #ifdef CONFIG_RTW_TOKEN_BASED_XMIT 757 u8 rtw_tbtx_chk_cmd(_adapter *adapter); 758 u8 rtw_tbtx_token_dispatch_cmd(_adapter *adapter); 759 #endif 760 761 #ifdef CONFIG_WRITE_BCN_LEN_TO_FW 762 u8 rtw_write_bcnlen_to_fw_cmd(_adapter *padapter, u16 bcn_len); 763 #endif 764 765 u8 rtw_reqtxrpt_cmd(_adapter *adapter, u8 macid); 766 767 #ifdef CONFIG_CTRL_TXSS_BY_TP 768 struct txss_cmd_parm { 769 struct sta_info *sta; 770 bool tx_1ss; 771 }; 772 773 void rtw_ctrl_txss_update_mimo_type(_adapter *adapter, struct sta_info *sta); 774 u8 rtw_ctrl_txss(_adapter *adapter, struct sta_info *sta, bool tx_1ss); 775 void rtw_ctrl_tx_ss_by_tp(_adapter *adapter, u8 from_timer); 776 777 #ifdef DBG_CTRL_TXSS 778 void dbg_ctrl_txss(_adapter *adapter, bool tx_1ss); 779 #endif 780 #endif 781 782 u8 rtw_drvextra_cmd_hdl(_adapter *padapter, unsigned char *pbuf); 783 784 extern void rtw_survey_cmd_callback(_adapter *padapter, struct cmd_obj *pcmd); 785 extern void rtw_disassoc_cmd_callback(_adapter *padapter, struct cmd_obj *pcmd); 786 extern void rtw_joinbss_cmd_callback(_adapter *padapter, struct cmd_obj *pcmd); 787 void rtw_create_ibss_post_hdl(_adapter *padapter, int status); 788 extern void rtw_readtssi_cmdrsp_callback(_adapter *padapter, struct cmd_obj *pcmd); 789 790 extern void rtw_setstaKey_cmdrsp_callback(_adapter *padapter, struct cmd_obj *pcmd); 791 extern void rtw_getrttbl_cmdrsp_callback(_adapter *padapter, struct cmd_obj *pcmd); 792 793 enum rtw_cmd_id { 794 CMD_JOINBSS, /*0*/ 795 CMD_DISCONNECT, /*1*/ 796 CMD_CREATE_BSS,/*2*/ 797 CMD_SET_OPMODE, /*3*/ 798 CMD_SITE_SURVEY, /*4*/ 799 CMD_SET_AUTH, /*5*/ 800 CMD_SET_KEY, /*6*/ 801 CMD_SET_STAKEY, /*7*/ 802 CMD_ADD_BAREQ, /*8*/ 803 CMD_SET_CHANNEL, /*9*/ 804 CMD_TX_BEACON, /*10*/ 805 CMD_SET_MLME_EVT, /*11*/ 806 CMD_SET_DRV_EXTRA, /*12*/ 807 CMD_SET_CHANPLAN, /*13*/ 808 CMD_LEDBLINK, /*14*/ 809 CMD_SET_CHANSWITCH, /*15*/ 810 CMD_TDLS, /*16*/ 811 CMD_CHK_BMCSLEEPQ, /*17*/ 812 CMD_RUN_INTHREAD, /*18*/ 813 CMD_ADD_BARSP, /*19*/ 814 CMD_RM_POST_EVENT, /*20*/ 815 CMD_SET_MESH_PLINK_STATE, /* 21 */ 816 CMD_DO_IQK, /* 22 */ 817 CMD_GET_CHANPLAN, /*23*/ 818 CMD_WRITE_BCN_LEN, /*24 */ 819 CMD_AP_CHANSWITCH, /* 25 AP switch channel */ 820 CMD_REQ_TXRPT, /* 26 */ 821 CMD_ID_MAX 822 }; 823 824 #define CMD_FMT "cmd=%d,%d,%d" 825 #define CMD_ARG(cmd) \ 826 (cmd)->cmdcode, \ 827 (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), \ 828 (cmd)->cmdcode == CMD_SET_DRV_EXTRA ? ((struct drvextra_cmd_parm *)(cmd)->parmbuf)->type : 0 829 830 #endif /* _CMD_H_ */ 831