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 }; 368 369 /* 370 Caller Mode: Any 371 372 Notes: To set the auth type of RTL8711. open/shared/802.1x 373 374 Command Mode 375 376 */ 377 struct setauth_parm { 378 u8 mode; /* 0: legacy open, 1: legacy shared 2: 802.1x */ 379 u8 _1x; /* 0: PSK, 1: TLS */ 380 u8 rsvd[2]; 381 }; 382 383 /* 384 Caller Mode: Infra 385 386 a. algorithm: wep40, wep104, tkip & aes 387 b. keytype: grp key/unicast key 388 c. key contents 389 390 when shared key ==> keyid is the camid 391 when 802.1x ==> keyid [0:1] ==> grp key 392 when 802.1x ==> keyid > 2 ==> unicast key 393 394 */ 395 struct setkey_parm { 396 u8 algorithm; /* encryption algorithm, could be none, wep40, TKIP, CCMP, wep104 */ 397 u8 keyid; 398 u8 set_tx; /* 1: main tx key for wep. 0: other key. */ 399 u8 key[32]; /* this could be 40 or 104 */ 400 }; 401 402 /* 403 When in AP or Ad-Hoc mode, this is used to 404 allocate an sw/hw entry for a newly associated sta. 405 406 Command 407 408 when shared key ==> algorithm/keyid 409 410 */ 411 struct set_stakey_parm { 412 u8 addr[ETH_ALEN]; 413 u8 algorithm; 414 u8 keyid; 415 u8 key[32]; 416 u8 gk; 417 }; 418 419 struct set_stakey_rsp { 420 u8 addr[ETH_ALEN]; 421 u8 keyid; 422 u8 rsvd; 423 }; 424 425 struct Tx_Beacon_param { 426 WLAN_BSSID_EX network; 427 }; 428 429 /* 430 Notes: This command is used for H2C/C2H loopback testing 431 432 mac[0] == 0 433 ==> CMD mode, return H2C_SUCCESS. 434 The following condition must be ture under CMD mode 435 mac[1] == mac[4], mac[2] == mac[3], mac[0]=mac[5]= 0; 436 s0 == 0x1234, s1 == 0xabcd, w0 == 0x78563412, w1 == 0x5aa5def7; 437 s2 == (b1 << 8 | b0); 438 439 mac[0] == 1 440 ==> CMD_RSP mode, return H2C_SUCCESS_RSP 441 442 The rsp layout shall be: 443 rsp: parm: 444 mac[0] = mac[5]; 445 mac[1] = mac[4]; 446 mac[2] = mac[3]; 447 mac[3] = mac[2]; 448 mac[4] = mac[1]; 449 mac[5] = mac[0]; 450 s0 = s1; 451 s1 = swap16(s0); 452 w0 = swap32(w1); 453 b0 = b1 454 s2 = s0 + s1 455 b1 = b0 456 w1 = w0 457 458 mac[0] == 2 459 ==> CMD_EVENT mode, return H2C_SUCCESS 460 The event layout shall be: 461 event: parm: 462 mac[0] = mac[5]; 463 mac[1] = mac[4]; 464 mac[2] = event's sequence number, starting from 1 to parm's marc[3] 465 mac[3] = mac[2]; 466 mac[4] = mac[1]; 467 mac[5] = mac[0]; 468 s0 = swap16(s0) - event.mac[2]; 469 s1 = s1 + event.mac[2]; 470 w0 = swap32(w0); 471 b0 = b1 472 s2 = s0 + event.mac[2] 473 b1 = b0 474 w1 = swap32(w1) - event.mac[2]; 475 476 parm->mac[3] is the total event counts that host requested. 477 478 479 event will be the same with the cmd's param. 480 481 */ 482 483 #ifdef CONFIG_H2CLBK 484 485 struct seth2clbk_parm { 486 u8 mac[6]; 487 u16 s0; 488 u16 s1; 489 u32 w0; 490 u8 b0; 491 u16 s2; 492 u8 b1; 493 u32 w1; 494 }; 495 496 struct geth2clbk_parm { 497 u32 rsv; 498 }; 499 500 struct geth2clbk_rsp { 501 u8 mac[6]; 502 u16 s0; 503 u16 s1; 504 u32 w0; 505 u8 b0; 506 u16 s2; 507 u8 b1; 508 u32 w1; 509 }; 510 511 #endif /* CONFIG_H2CLBK */ 512 513 /* CMD param Formart for driver extra cmd handler */ 514 struct drvextra_cmd_parm { 515 int ec_id; /* extra cmd id */ 516 int type; /* Can use this field as the type id or command size */ 517 int size; /* buffer size */ 518 unsigned char *pbuf; 519 }; 520 521 /*------------------- Below are used for RF/BB tunning ---------------------*/ 522 struct addBaReq_parm { 523 unsigned int tid; 524 u8 addr[ETH_ALEN]; 525 }; 526 527 struct addBaRsp_parm { 528 unsigned int tid; 529 unsigned int start_seq; 530 u8 addr[ETH_ALEN]; 531 u8 status; 532 u8 size; 533 }; 534 535 struct set_ch_parm { 536 u8 ch; 537 u8 bw; 538 u8 ch_offset; 539 }; 540 541 struct SetChannelPlan_param { 542 const struct country_chplan *country_ent; 543 u8 channel_plan; 544 }; 545 546 struct LedBlink_param { 547 void *pLed; 548 }; 549 550 struct TDLSoption_param { 551 u8 addr[ETH_ALEN]; 552 u8 option; 553 }; 554 555 struct RunInThread_param { 556 void (*func)(void *); 557 void *context; 558 }; 559 560 561 #define GEN_CMD_CODE(cmd) cmd ## _CMD_ 562 563 564 /* 565 566 Result: 567 0x00: success 568 0x01: sucess, and check Response. 569 0x02: cmd ignored due to duplicated sequcne number 570 0x03: cmd dropped due to invalid cmd code 571 0x04: reserved. 572 573 */ 574 575 #define H2C_RSP_OFFSET 512 576 577 #define H2C_SUCCESS 0x00 578 #define H2C_SUCCESS_RSP 0x01 579 #define H2C_DUPLICATED 0x02 580 #define H2C_DROPPED 0x03 581 #define H2C_PARAMETERS_ERROR 0x04 582 #define H2C_REJECTED 0x05 583 #define H2C_CMD_OVERFLOW 0x06 584 #define H2C_RESERVED 0x07 585 #define H2C_ENQ_HEAD 0x08 586 #define H2C_ENQ_HEAD_FAIL 0x09 587 #define H2C_CMD_FAIL 0x0A 588 589 void rtw_init_sitesurvey_parm(_adapter *padapter, struct sitesurvey_parm *pparm); 590 u8 rtw_sitesurvey_cmd(_adapter *padapter, struct sitesurvey_parm *pparm); 591 #ifdef CONFIG_AP_MODE 592 u8 rtw_create_ibss_cmd(_adapter *adapter, int flags); 593 u8 rtw_startbss_cmd(_adapter *adapter, int flags); 594 #endif 595 596 #define REQ_CH_NONE -1 597 #define REQ_CH_INT_INFO -2 598 #define REQ_BW_NONE -1 599 #define REQ_BW_ORI -2 600 #define REQ_OFFSET_NONE -1 601 602 struct sta_info; 603 extern u8 rtw_setstakey_cmd(_adapter *padapter, struct sta_info *sta, u8 key_type, bool enqueue); 604 extern u8 rtw_clearstakey_cmd(_adapter *padapter, struct sta_info *sta, u8 enqueue); 605 606 extern u8 rtw_joinbss_cmd(_adapter *padapter, struct wlan_network *pnetwork); 607 u8 rtw_disassoc_cmd(_adapter *padapter, u32 deauth_timeout_ms, int flags); 608 #ifdef CONFIG_AP_MODE 609 u8 rtw_change_bss_chbw_cmd(_adapter *adapter, int flags 610 , u8 ifbmp, u8 excl_ifbmp, s16 req_ch, s8 req_bw, s8 req_offset); 611 u8 rtw_stop_ap_cmd(_adapter *adapter, u8 flags); 612 #endif 613 #ifdef CONFIG_RTW_TOKEN_BASED_XMIT 614 u8 rtw_tx_control_cmd(_adapter *adapter); 615 #endif 616 extern u8 rtw_setopmode_cmd(_adapter *padapter, NDIS_802_11_NETWORK_INFRASTRUCTURE networktype, u8 flags); 617 618 extern u8 rtw_addbareq_cmd(_adapter *padapter, u8 tid, u8 *addr); 619 extern u8 rtw_addbarsp_cmd(_adapter *padapter, u8 *addr, u16 tid, u8 status, u8 size, u16 start_seq); 620 /* add for CONFIG_IEEE80211W, none 11w also can use */ 621 extern u8 rtw_reset_securitypriv_cmd(_adapter *padapter); 622 extern u8 rtw_free_assoc_resources_cmd(_adapter *padapter, u8 lock_scanned_queue, int flags); 623 extern u8 rtw_dynamic_chk_wk_cmd(_adapter *adapter); 624 625 u8 rtw_lps_ctrl_wk_cmd(_adapter *padapter, u8 lps_ctrl_type, u8 flags); 626 u8 rtw_lps_ctrl_leave_set_level_cmd(_adapter *adapter, u8 lps_level, u8 flags); 627 #ifdef CONFIG_LPS_1T1R 628 u8 rtw_lps_ctrl_leave_set_1t1r_cmd(_adapter *adapter, u8 lps_1t1r, u8 flags); 629 #endif 630 u8 rtw_dm_in_lps_wk_cmd(_adapter *padapter); 631 u8 rtw_lps_change_dtim_cmd(_adapter *padapter, u8 dtim); 632 633 #if (RATE_ADAPTIVE_SUPPORT == 1) 634 u8 rtw_rpt_timer_cfg_cmd(_adapter *padapter, u16 minRptTime); 635 #endif 636 637 #ifdef CONFIG_ANTENNA_DIVERSITY 638 extern u8 rtw_antenna_select_cmd(_adapter *padapter, u8 antenna, u8 enqueue); 639 #endif 640 641 u8 rtw_dm_ra_mask_wk_cmd(_adapter *padapter, u8 *psta); 642 643 extern u8 rtw_ps_cmd(_adapter *padapter); 644 645 #if CONFIG_DFS 646 void rtw_dfs_ch_switch_hdl(struct dvobj_priv *dvobj); 647 #endif 648 649 #ifdef CONFIG_AP_MODE 650 u8 rtw_chk_hi_queue_cmd(_adapter *padapter); 651 #ifdef CONFIG_DFS_MASTER 652 u8 rtw_dfs_rd_cmd(_adapter *adapter, bool enqueue); 653 void rtw_dfs_rd_timer_hdl(void *ctx); 654 void rtw_dfs_rd_en_decision(_adapter *adapter, u8 mlme_act, u8 excl_ifbmp); 655 u8 rtw_dfs_rd_en_decision_cmd(_adapter *adapter); 656 #endif /* CONFIG_DFS_MASTER */ 657 #endif /* CONFIG_AP_MODE */ 658 659 #ifdef CONFIG_BT_COEXIST 660 u8 rtw_btinfo_cmd(PADAPTER padapter, u8 *pbuf, u16 length); 661 u8 rtw_btc_reduce_wl_txpwr_cmd(_adapter *adapter, u32 val); 662 #endif 663 664 u8 rtw_test_h2c_cmd(_adapter *adapter, u8 *buf, u8 len); 665 666 u8 rtw_enable_hw_update_tsf_cmd(_adapter *padapter); 667 u8 rtw_periodic_tsf_update_end_cmd(_adapter *adapter); 668 669 u8 rtw_set_chbw_cmd(_adapter *padapter, u8 ch, u8 bw, u8 ch_offset, u8 flags); 670 u8 rtw_iqk_cmd(_adapter *padapter, u8 flags); 671 672 u8 rtw_set_chplan_cmd(_adapter *adapter, int flags, u8 chplan, u8 swconfig); 673 u8 rtw_set_country_cmd(_adapter *adapter, int flags, const char *country_code, u8 swconfig); 674 675 extern u8 rtw_led_blink_cmd(_adapter *padapter, void *pLed); 676 extern u8 rtw_set_csa_cmd(_adapter *adapter); 677 extern u8 rtw_tdls_cmd(_adapter *padapter, u8 *addr, u8 option); 678 679 u8 rtw_mp_cmd(_adapter *adapter, u8 mp_cmd_id, u8 flags); 680 681 #ifdef CONFIG_RTW_CUSTOMER_STR 682 u8 rtw_customer_str_req_cmd(_adapter *adapter); 683 u8 rtw_customer_str_write_cmd(_adapter *adapter, const u8 *cstr); 684 #endif 685 686 #ifdef CONFIG_FW_C2H_REG 687 u8 rtw_c2h_reg_wk_cmd(_adapter *adapter, u8 *c2h_evt); 688 #endif 689 #ifdef CONFIG_FW_C2H_PKT 690 u8 rtw_c2h_packet_wk_cmd(_adapter *adapter, u8 *c2h_evt, u16 length); 691 #endif 692 693 #ifdef CONFIG_RTW_REPEATER_SON 694 #define RSON_SCAN_PROCESS 10 695 #define RSON_SCAN_DISABLE 11 696 u8 rtw_rson_scan_wk_cmd(_adapter *adapter, int op); 697 #endif 698 699 u8 rtw_run_in_thread_cmd(_adapter *adapter, void (*func)(void *), void *context); 700 u8 rtw_run_in_thread_cmd_wait(_adapter *adapter, void (*func)(void *), void *context, s32 timeout_ms); 701 702 struct ssmps_cmd_parm { 703 struct sta_info *sta; 704 u8 smps; 705 }; 706 u8 rtw_ssmps_wk_cmd(_adapter *adapter, struct sta_info *sta, u8 smps, u8 enqueue); 707 708 u8 session_tracker_chk_cmd(_adapter *adapter, struct sta_info *sta); 709 u8 session_tracker_add_cmd(_adapter *adapter, struct sta_info *sta, u8 *local_naddr, u8 *local_port, u8 *remote_naddr, u8 *remote_port); 710 u8 session_tracker_del_cmd(_adapter *adapter, struct sta_info *sta, u8 *local_naddr, u8 *local_port, u8 *remote_naddr, u8 *remote_port); 711 712 u8 set_txq_params_cmd(_adapter *adapter, u32 ac_parm, u8 ac_type); 713 714 #if defined(CONFIG_RTW_MESH) && defined(RTW_PER_CMD_SUPPORT_FW) 715 u8 rtw_req_per_cmd(_adapter * adapter); 716 #endif 717 #ifdef CONFIG_RTW_TOKEN_BASED_XMIT 718 u8 rtw_tbtx_chk_cmd(_adapter *adapter); 719 u8 rtw_tbtx_token_dispatch_cmd(_adapter *adapter); 720 #endif 721 #ifdef CONFIG_CTRL_TXSS_BY_TP 722 struct txss_cmd_parm { 723 struct sta_info *sta; 724 bool tx_1ss; 725 }; 726 727 void rtw_ctrl_txss_update_mimo_type(_adapter *adapter, struct sta_info *sta); 728 u8 rtw_ctrl_txss(_adapter *adapter, struct sta_info *sta, bool tx_1ss); 729 void rtw_ctrl_tx_ss_by_tp(_adapter *adapter, u8 from_timer); 730 731 #ifdef DBG_CTRL_TXSS 732 void dbg_ctrl_txss(_adapter *adapter, bool tx_1ss); 733 #endif 734 #endif 735 736 u8 rtw_drvextra_cmd_hdl(_adapter *padapter, unsigned char *pbuf); 737 738 extern void rtw_survey_cmd_callback(_adapter *padapter, struct cmd_obj *pcmd); 739 extern void rtw_disassoc_cmd_callback(_adapter *padapter, struct cmd_obj *pcmd); 740 extern void rtw_joinbss_cmd_callback(_adapter *padapter, struct cmd_obj *pcmd); 741 void rtw_create_ibss_post_hdl(_adapter *padapter, int status); 742 extern void rtw_readtssi_cmdrsp_callback(_adapter *padapter, struct cmd_obj *pcmd); 743 744 extern void rtw_setstaKey_cmdrsp_callback(_adapter *padapter, struct cmd_obj *pcmd); 745 extern void rtw_getrttbl_cmdrsp_callback(_adapter *padapter, struct cmd_obj *pcmd); 746 747 enum rtw_cmd_id { 748 CMD_JOINBSS, /*0*/ 749 CMD_DISCONNECT, /*1*/ 750 CMD_CREATE_BSS,/*2*/ 751 CMD_SET_OPMODE, /*3*/ 752 CMD_SITE_SURVEY, /*4*/ 753 CMD_SET_AUTH, /*5*/ 754 CMD_SET_KEY, /*6*/ 755 CMD_SET_STAKEY, /*7*/ 756 CMD_ADD_BAREQ, /*8*/ 757 CMD_SET_CHANNEL, /*9*/ 758 CMD_TX_BEACON, /*10*/ 759 CMD_SET_MLME_EVT, /*11*/ 760 CMD_SET_DRV_EXTRA, /*12*/ 761 CMD_SET_CHANPLAN, /*13*/ 762 CMD_LEDBLINK, /*14*/ 763 CMD_SET_CHANSWITCH, /*15*/ 764 CMD_TDLS, /*16*/ 765 CMD_CHK_BMCSLEEPQ, /*17*/ 766 CMD_RUN_INTHREAD, /*18*/ 767 CMD_ADD_BARSP, /*19*/ 768 CMD_RM_POST_EVENT, /*20*/ 769 CMD_SET_MESH_PLINK_STATE, /* 21 */ 770 CMD_DO_IQK, /* 22 */ 771 CMD_ID_MAX 772 }; 773 774 #define CMD_FMT "cmd=%d,%d,%d" 775 #define CMD_ARG(cmd) \ 776 (cmd)->cmdcode, \ 777 (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), \ 778 (cmd)->cmdcode == CMD_SET_DRV_EXTRA ? ((struct drvextra_cmd_parm *)(cmd)->parmbuf)->type : 0 779 780 #endif /* _CMD_H_ */ 781