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