xref: /OK3568_Linux_fs/external/rkwifibt/drivers/rtl8852be/include/rtw_cmd.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 2019 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 
22 #define MAX_CMDSZ	1536
23 #define MAX_RSPSZ	512
24 #define MAX_EVTSZ	1024
25 
26 #define CMDBUFF_ALIGN_SZ 512
27 
28 struct cmd_obj {
29 	_adapter *padapter;
30 	u16	cmdcode;
31 	u8	res;
32 	u8	*parmbuf;
33 	u32	cmdsz;
34 	u8	*rsp;
35 	u32	rspsz;
36 	struct submit_ctx *sctx;
37 	u8 no_io;
38 	/* _sema 	cmd_sem; */
39 	_list	list;
40 };
41 
42 /* cmd flags */
43 enum {
44 	RTW_CMDF_DIRECTLY = BIT0,
45 	RTW_CMDF_WAIT_ACK = BIT1,
46 };
47 
48 struct cmd_priv {
49 	u8	cmd_seq;
50 	u8	*cmd_buf;	/* shall be non-paged, and 4 bytes aligned */
51 	u8	*cmd_allocated_buf;
52 	u8	*rsp_buf;	/* shall be non-paged, and 4 bytes aligned */
53 	u8	*rsp_allocated_buf;
54 	u32	cmd_issued_cnt;
55 
56 	struct dvobj_priv *dvobj;
57 	_mutex sctx_mutex;
58 	ATOMIC_T event_seq;
59 	u32 evt_done_cnt;
60 
61 	#if 0 /*#ifdef CONFIG_CORE_CMD_THREAD*/
62 	_queue	cmd_queue;
63 	_sema	cmd_queue_sema;
64 	_sema	start_cmdthread_sema;
65 	ATOMIC_T cmdthd_running;
66 	#endif
67 };
68 
69 struct back_op_param {
70 	unsigned int off_ch_dur;
71 	unsigned int off_ch_ext_dur; /* extend when MGNT_TX */
72 	unsigned int on_ch_dur;
73 };
74 
75 #define init_h2fwcmd_w_parm_no_rsp(pcmd, pparm, code) \
76 	do {\
77 		_rtw_init_listhead(&pcmd->list);\
78 		pcmd->cmdcode = code;\
79 		pcmd->parmbuf = (u8 *)(pparm);\
80 		pcmd->cmdsz = sizeof (*pparm);\
81 		pcmd->rsp = NULL;\
82 		pcmd->rspsz = 0;\
83 	} while (0)
84 
85 #define init_h2fwcmd_w_parm_no_parm_rsp(pcmd, code) \
86 	do {\
87 		_rtw_init_listhead(&pcmd->list);\
88 		pcmd->cmdcode = code;\
89 		pcmd->parmbuf = NULL;\
90 		pcmd->cmdsz = 0;\
91 		pcmd->rsp = NULL;\
92 		pcmd->rspsz = 0;\
93 	} while (0)
94 
95 struct P2P_PS_Offload_t {
96 	u8 Offload_En:1;
97 	u8 role:1; /* 1: Owner, 0: Client */
98 	u8 CTWindow_En:1;
99 	u8 NoA0_En:1;
100 	u8 NoA1_En:1;
101 	u8 AllStaSleep:1; /* Only valid in Owner */
102 	u8 discovery:1;
103 	u8 rsvd:1;
104 #ifdef CONFIG_P2P_PS_NOA_USE_MACID_SLEEP
105 	u8 p2p_macid:7;
106 	u8 disable_close_rf:1; /*1: not close RF but just pause p2p_macid when NoA duration*/
107 #endif /* CONFIG_P2P_PS_NOA_USE_MACID_SLEEP */
108 };
109 
110 struct P2P_PS_CTWPeriod_t {
111 	u8 CTWPeriod;	/* TU */
112 };
113 
114 #ifdef CONFIG_P2P_WOWLAN
115 
116 struct P2P_WoWlan_Offload_t {
117 	u8 Disconnect_Wkup_Drv:1;
118 	u8 role:2;
119 	u8 Wps_Config[2];
120 };
121 
122 #endif /* CONFIG_P2P_WOWLAN */
123 
124 extern u32 rtw_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *obj);
125 
126 extern void rtw_free_cmd_obj(struct cmd_obj *pcmd);
127 
128 #if 0 /*#ifdef CONFIG_CORE_CMD_THREAD*/
129 void rtw_stop_cmd_thread(_adapter *adapter);
130 thread_return rtw_cmd_thread(thread_context context);
131 #endif
132 
133 u32 rtw_init_cmd_priv(struct dvobj_priv *dvobj);
134 void rtw_free_cmd_priv(struct dvobj_priv *dvobj);
135 
136 #ifdef CONFIG_IOCTL_CFG80211
137 u8 rtw_mgnt_tx_cmd(_adapter *adapter, u8 tx_ch, u8 no_cck, const u8 *buf, size_t len, int wait_ack, u8 flags);
138 struct mgnt_tx_parm {
139 	u8 tx_ch;
140 	u8 no_cck;
141 	const u8 *buf;
142 	size_t len;
143 	int wait_ack;
144 };
145 #endif
146 
147 enum rtw_drvextra_cmd_id {
148 	NONE_WK_CID, /*MCC_CMD_WK_CID*/
149 	STA_MSTATUS_RPT_WK_CID,
150 	#if 0 /*#ifdef CONFIG_CORE_DM_CHK_TIMER*/
151 	DYNAMIC_CHK_WK_CID,
152 	#endif
153 	DM_CTRL_WK_CID,
154 	PBC_POLLING_WK_CID,
155 	#ifdef CONFIG_POWER_SAVING
156 	POWER_SAVING_CTRL_WK_CID,/* IPS,AUTOSuspend */
157 	#endif
158 	LPS_CTRL_WK_CID,
159 	ANT_SELECT_WK_CID,
160 	P2P_PS_WK_CID,
161 	CHECK_HIQ_WK_CID,/* for softap mode, check hi queue if empty */
162 	C2H_WK_CID,
163 	RESET_SECURITYPRIV, /* add for CONFIG_IEEE80211W, none 11w also can use */
164 	FREE_ASSOC_RESOURCES, /* add for CONFIG_IEEE80211W, none 11w also can use */
165 	DM_IN_LPS_WK_CID,
166 	LPS_CHANGE_DTIM_CID,
167 	DFS_RADAR_DETECT_WK_CID,
168 	DFS_RADAR_DETECT_EN_DEC_WK_CID,
169 	SESSION_TRACKER_WK_CID,
170 	TEST_H2C_CID,
171 	MP_CMD_WK_CID,
172 	CUSTOMER_STR_WK_CID,
173 	MGNT_TX_WK_CID,
174 	REQ_PER_CMD_WK_CID,
175 	SSMPS_WK_CID,
176 #ifdef CONFIG_CTRL_TXSS_BY_TP
177 	TXSS_WK_CID,
178 #endif
179 	AC_PARM_CMD_WK_CID,
180 #ifdef CONFIG_AP_MODE
181 	STOP_AP_WK_CID,
182 #endif
183 #ifdef CONFIG_RTW_TOKEN_BASED_XMIT
184 	TBTX_CONTROL_TX_WK_CID,
185 #endif
186 	TSF_SYNC_DONE_WK_CID,
187 #ifdef ROKU_PRIVATE
188 	FIND_REMOTE_WK_CID,
189 #ifdef CONFIG_P2P
190 	HIDE_SSID_WK_CID,
191 #endif
192 #endif
193 	MAX_WK_CID
194 };
195 
196 enum LPS_CTRL_TYPE {
197 	LPS_CTRL_SCAN = 0,
198 	LPS_CTRL_JOINBSS = 1,
199 	LPS_CTRL_CONNECT = 2,
200 	LPS_CTRL_DISCONNECT = 3,
201 	LPS_CTRL_SPECIAL_PACKET = 4,
202 	LPS_CTRL_LEAVE = 5,
203 	LPS_CTRL_TRAFFIC_BUSY = 6,
204 	LPS_CTRL_TX_TRAFFIC_LEAVE = 7,
205 	LPS_CTRL_RX_TRAFFIC_LEAVE = 8,
206 	LPS_CTRL_ENTER = 9,
207 	LPS_CTRL_LEAVE_CFG80211_PWRMGMT = 10,
208 	LPS_CTRL_LEAVE_SET_OPTION = 11,
209 };
210 
211 enum STAKEY_TYPE {
212 	GROUP_KEY		= 0,
213 	UNICAST_KEY		= 1,
214 	TDLS_KEY		= 2,
215 };
216 
217 enum RFINTFS {
218 	SWSI,
219 	HWSI,
220 	HWPI,
221 };
222 
223 
224 /*
225 Caller Mode: Infra, Ad-HoC(C)
226 
227 Notes: To disconnect the current associated BSS
228 
229 Command Mode
230 
231 */
232 struct disconnect_parm {
233 	u32 deauth_timeout_ms;
234 };
235 
236 /*
237 Caller Mode: AP, Ad-HoC(M)
238 
239 Notes: To create a BSS
240 
241 Command Mode
242 */
243 struct createbss_parm {
244 	bool adhoc;
245 
246 	/* used by AP/Mesh mode now */
247 	u8 ifbmp;
248 	u8 excl_ifbmp;
249 	s16 req_ch;
250 	s8 req_bw;
251 	s8 req_offset;
252 	u8 ifbmp_ch_changed;
253 	u8 ch_to_set;
254 	u8 offset_to_set;
255 	u8 bw_to_set;
256 	u8 do_rfk;
257 
258 };
259 
260 
261 struct	setopmode_parm {
262 	u8	mode;
263 	u8	rsvd[3];
264 };
265 
266 
267 /*
268 Caller Mode: Any
269 
270 Notes: To set the auth type of RTL8711. open/shared/802.1x
271 
272 Command Mode
273 
274 */
275 struct setauth_parm {
276 	u8 mode;  /* 0: legacy open, 1: legacy shared 2: 802.1x */
277 	u8 _1x;   /* 0: PSK, 1: TLS */
278 	u8 rsvd[2];
279 };
280 
281 /*
282 Caller Mode: Infra
283 
284 a. algorithm: wep40, wep104, tkip & aes
285 b. keytype: grp key/unicast key
286 c. key contents
287 
288 when shared key ==> keyid is the camid
289 when 802.1x ==> keyid [0:1] ==> grp key
290 when 802.1x ==> keyid > 2 ==> unicast key
291 
292 */
293 struct setkey_parm {
294 	u8	algorithm;	/* encryption algorithm, could be none, wep40, TKIP, CCMP, wep104 */
295 	u8	keyid;
296 	u8	set_tx;		/* 1: main tx key for wep. 0: other key. */
297 	u8	key[32];	/* this could be 40 or 104 */
298 };
299 
300 /*
301 When in AP or Ad-Hoc mode, this is used to
302 allocate an sw/hw entry for a newly associated sta.
303 
304 Command
305 
306 when shared key ==> algorithm/keyid
307 
308 */
309 struct set_stakey_parm {
310 	u8 addr[ETH_ALEN];
311 	u8 algorithm;
312 	u8 keyid;
313 	u8 key[32];
314 	u8 gk;
315 };
316 
317 struct set_stakey_rsp {
318 	u8	addr[ETH_ALEN];
319 	u8	keyid;
320 	u8	rsvd;
321 };
322 
323 struct Tx_Beacon_param {
324 	WLAN_BSSID_EX network;
325 };
326 
327 /*
328 	Notes: This command is used for H2C/C2H loopback testing
329 
330 	mac[0] == 0
331 	==> CMD mode, return H2C_SUCCESS.
332 	The following condition must be ture under CMD mode
333 		mac[1] == mac[4], mac[2] == mac[3], mac[0]=mac[5]= 0;
334 		s0 == 0x1234, s1 == 0xabcd, w0 == 0x78563412, w1 == 0x5aa5def7;
335 		s2 == (b1 << 8 | b0);
336 
337 	mac[0] == 1
338 	==> CMD_RSP mode, return H2C_SUCCESS_RSP
339 
340 	The rsp layout shall be:
341 	rsp:			parm:
342 		mac[0]  =   mac[5];
343 		mac[1]  =   mac[4];
344 		mac[2]  =   mac[3];
345 		mac[3]  =   mac[2];
346 		mac[4]  =   mac[1];
347 		mac[5]  =   mac[0];
348 		s0		=   s1;
349 		s1		=   swap16(s0);
350 		w0		=	swap32(w1);
351 		b0		=	b1
352 		s2		=	s0 + s1
353 		b1		=	b0
354 		w1		=	w0
355 
356 	mac[0] ==	2
357 	==> CMD_EVENT mode, return	H2C_SUCCESS
358 	The event layout shall be:
359 	event:			parm:
360 		mac[0]  =   mac[5];
361 		mac[1]  =   mac[4];
362 		mac[2]  =   event's sequence number, starting from 1 to parm's marc[3]
363 		mac[3]  =   mac[2];
364 		mac[4]  =   mac[1];
365 		mac[5]  =   mac[0];
366 		s0		=   swap16(s0) - event.mac[2];
367 		s1		=   s1 + event.mac[2];
368 		w0		=	swap32(w0);
369 		b0		=	b1
370 		s2		=	s0 + event.mac[2]
371 		b1		=	b0
372 		w1		=	swap32(w1) - event.mac[2];
373 
374 		parm->mac[3] is the total event counts that host requested.
375 
376 
377 	event will be the same with the cmd's param.
378 
379 */
380 
381 /* CMD param Formart for driver extra cmd handler */
382 struct drvextra_cmd_parm {
383 	int ec_id; /* extra cmd id */
384 	int type; /* Can use this field as the type id or command size */
385 	int size; /* buffer size */
386 	unsigned char *pbuf;
387 };
388 
389 /*------------------- Below are used for RF/BB tunning ---------------------*/
390 struct addBaReq_parm {
391 	unsigned int tid;
392 	u8	addr[ETH_ALEN];
393 };
394 
395 struct addBaRsp_parm {
396 	unsigned int tid;
397 	unsigned int start_seq;
398 	u8 addr[ETH_ALEN];
399 	u8 status;
400 	u8 size;
401 	struct ADDBA_request preq;
402 };
403 
404 struct set_ch_parm {
405 	u8 ch;
406 	u8 bw;
407 	u8 ch_offset;
408 	u8 do_rfk;
409 };
410 
411 struct SetChannelPlan_param {
412 	enum regd_src_t regd_src;
413 	enum rtw_regd_inr inr;
414 	struct country_chplan country_ent;
415 	bool has_country;
416 	u8 channel_plan;
417 #if CONFIG_IEEE80211_BAND_6GHZ
418 	u8 channel_plan_6g;
419 #endif
420 
421 #ifdef CONFIG_80211D
422 	/* used for regd_src == RTK_PRIV and inr == COUNTRY_IE */
423 	struct country_ie_slave_record cisr;
424 	bool has_cisr;
425 #endif
426 
427 #ifdef PLATFORM_LINUX
428 	bool rtnl_lock_needed;
429 #endif
430 };
431 
432 struct get_channel_plan_param {
433 	struct get_chplan_resp **chplan;
434 };
435 
436 struct LedBlink_param {
437 	void *pLed;
438 };
439 
440 struct TDLSoption_param {
441 	u8 addr[ETH_ALEN];
442 	u8 option;
443 };
444 
445 struct RunInThread_param {
446 	void (*func)(void *);
447 	void *context;
448 };
449 
450 
451 #define GEN_CMD_CODE(cmd)	cmd ## _CMD_
452 
453 
454 /*
455 
456 Result:
457 0x00: success
458 0x01: sucess, and check Response.
459 0x02: cmd ignored due to duplicated sequcne number
460 0x03: cmd dropped due to invalid cmd code
461 0x04: reserved.
462 
463 */
464 
465 #define H2C_RSP_OFFSET			512
466 
467 #define H2C_SUCCESS			0x00
468 #define H2C_SUCCESS_RSP			0x01
469 #define H2C_DUPLICATED			0x02
470 #define H2C_DROPPED			0x03
471 #define H2C_PARAMETERS_ERROR		0x04
472 #define H2C_REJECTED			0x05
473 #define H2C_CMD_OVERFLOW		0x06
474 #define H2C_RESERVED			0x07
475 #define H2C_ENQ_HEAD			0x08
476 #define H2C_ENQ_HEAD_FAIL		0x09
477 #define H2C_CMD_FAIL			0x0A
478 
479 
480 u8 rtw_create_ibss_cmd(_adapter *adapter, int flags);
481 u8 rtw_startbss_cmd(_adapter *adapter, int flags);
482 
483 #define REQ_CH_NONE		-1
484 #define REQ_CH_INT_INFO	-2
485 #define REQ_BW_NONE		-1
486 #define REQ_BW_ORI		-2
487 #define REQ_OFFSET_NONE	-1
488 
489 u8 rtw_change_bss_chbw_cmd(_adapter *adapter, int flags
490 	, u8 ifbmp, u8 excl_ifbmp, s16 req_ch, s8 req_bw, s8 req_offset);
491 
492 struct sta_info;
493 extern u8 rtw_setstakey_cmd(_adapter  *padapter, struct sta_info *sta, u8 key_type, bool enqueue);
494 extern u8 rtw_clearstakey_cmd(_adapter *padapter, struct sta_info *sta, u8 enqueue);
495 
496 extern u8 rtw_joinbss_cmd(_adapter  *padapter, struct wlan_network *pnetwork);
497 u8 rtw_disassoc_cmd(_adapter *padapter, u32 deauth_timeout_ms, int flags);
498 #ifdef CONFIG_AP_MODE
499 u8 rtw_stop_ap_cmd(_adapter *adapter, u8 flags);
500 #endif
501 #ifdef CONFIG_RTW_TOKEN_BASED_XMIT
502 u8 rtw_tx_control_cmd(_adapter *adapter);
503 #endif
504 extern u8 rtw_setopmode_cmd(_adapter  *padapter, NDIS_802_11_NETWORK_INFRASTRUCTURE networktype, u8 flags);
505 
506 extern u8 rtw_addbareq_cmd(_adapter *padapter, u8 tid, u8 *addr);
507 extern u8 rtw_addbarsp_cmd(_adapter *padapter, u8 *addr, u16 tid,
508 			   struct ADDBA_request *paddba_req, u8 status, u8 size,
509 			   u16 start_seq);
510 extern u8 rtw_delba_cmd(struct _ADAPTER *a, u8 *addr, u16 tid);
511 /* add for CONFIG_IEEE80211W, none 11w also can use */
512 extern u8 rtw_reset_securitypriv_cmd(_adapter *padapter);
513 extern u8 rtw_free_assoc_resources_cmd(_adapter *padapter, u8 lock_scanned_queue, int flags);
514 #if 0 /*#ifdef CONFIG_CORE_DM_CHK_TIMER*/
515 extern u8 rtw_dynamic_chk_wk_cmd(_adapter *adapter);
516 #endif
517 #ifdef ROKU_PRIVATE
518 extern u8 rtw_find_remote_wk_cmd(_adapter *adapter);
519 #ifdef CONFIG_P2P
520 extern u8 rtw_hide_ssid_wk_cmd(_adapter *adapter);
521 #endif
522 #endif
523 u8 rtw_lps_ctrl_wk_cmd(_adapter *padapter, u8 lps_ctrl_type, u8 flags);
524 u8 rtw_lps_ctrl_leave_set_level_cmd(_adapter *adapter, u8 lps_level, u8 flags);
525 #ifdef CONFIG_LPS_1T1R
526 u8 rtw_lps_ctrl_leave_set_1t1r_cmd(_adapter *adapter, u8 lps_1t1r, u8 flags);
527 #endif
528 u8 rtw_dm_in_lps_wk_cmd(_adapter *padapter);
529 u8 rtw_lps_change_dtim_cmd(_adapter *padapter, u8 dtim);
530 
531 #ifdef CONFIG_ANTENNA_DIVERSITY
532 extern  u8 rtw_antenna_select_cmd(_adapter *padapter, u8 antenna, u8 enqueue);
533 #endif
534 
535 #ifdef CONFIG_POWER_SAVING
536 extern u8 rtw_ps_cmd(_adapter *padapter);
537 #endif
538 #if CONFIG_DFS
539 void rtw_dfs_ch_switch_hdl(_adapter *adapter);
540 #endif
541 
542 #ifdef CONFIG_AP_MODE
543 u8 rtw_chk_hi_queue_cmd(_adapter *padapter);
544 #ifdef CONFIG_DFS_MASTER
545 u8 rtw_dfs_rd_cmd(_adapter *adapter, bool enqueue);
546 void rtw_dfs_rd_timer_hdl(void *ctx);
547 void rtw_dfs_rd_en_decision(_adapter *adapter, u8 mlme_act, u8 excl_ifbmp);
548 u8 rtw_dfs_rd_en_decision_cmd(_adapter *adapter);
549 #endif /* CONFIG_DFS_MASTER */
550 #endif /* CONFIG_AP_MODE */
551 
552 #ifdef CONFIG_BTC
553 u8 rtw_btinfo_cmd(_adapter *padapter, u8 *pbuf, u16 length);
554 u8 rtw_btc_reduce_wl_txpwr_cmd(_adapter *adapter, u32 val);
555 #endif
556 
557 u8 rtw_test_h2c_cmd(_adapter *adapter, u8 *buf, u8 len);
558 #if defined(RTW_PHL_DBG_CMD)
559 void core_cmd_phl_handler(_adapter *adapter, char *extra);
560 void core_add_record(_adapter *adapter, u8 type, void *p);
561 void phl_add_record(void *d, u8 type, void *p, u32 size);
562 #endif
563 
564 u8 rtw_set_chbw_cmd(_adapter *padapter, u8 ch, u8 bw, u8 ch_offset, u8 flags);
565 
566 u8 rtw_set_chplan_cmd(_adapter *adapter, int flags, u8 chplan, u8 chplan_6g, enum rtw_regd_inr inr);
567 u8 rtw_set_country_cmd(_adapter *adapter, int flags, const char *country_code, enum rtw_regd_inr inr);
568 #ifdef CONFIG_REGD_SRC_FROM_OS
569 u8 rtw_sync_os_regd_cmd(_adapter *adapter, int flags, const char *country_code, u8 dfs_region, enum rtw_regd_inr inr);
570 #endif
571 u8 rtw_get_chplan_cmd(_adapter *adapter, int flags, struct get_chplan_resp **chplan);
572 
573 #ifdef CONFIG_80211D
574 u8 rtw_apply_recv_country_ie_cmd(_adapter *adapter, int flags, enum band_type band,u8 opch, const u8 *country_ie);
575 #endif
576 
577 #ifdef CONFIG_RTW_LED_HANDLED_BY_CMD_THREAD
578 u8 rtw_led_blink_cmd(_adapter *padapter, void *pLed);
579 #endif
580 extern u8 rtw_set_csa_cmd(_adapter *adapter);
581 extern u8 rtw_tdls_cmd(_adapter *padapter, u8 *addr, u8 option);
582 
583 u8 rtw_mp_cmd(_adapter *adapter, u8 mp_cmd_id, u8 flags);
584 
585 #ifdef CONFIG_RTW_CUSTOMER_STR
586 u8 rtw_customer_str_req_cmd(_adapter *adapter);
587 u8 rtw_customer_str_write_cmd(_adapter *adapter, const u8 *cstr);
588 #endif
589 
590 u8 rtw_c2h_packet_wk_cmd(_adapter *adapter, u8 *c2h_evt, u16 length);
591 
592 u8 rtw_run_in_thread_cmd(_adapter *adapter, void (*func)(void *), void *context);
593 u8 rtw_run_in_thread_cmd_wait(_adapter *adapter, void (*func)(void *), void *context, s32 timeout_ms);
594 
595 struct ssmps_cmd_parm {
596 	struct sta_info *sta;
597 	u8 smps;
598 };
599 u8 rtw_ssmps_wk_cmd(_adapter *adapter, struct sta_info *sta, u8 smps, u8 enqueue);
600 
601 u8 session_tracker_chk_cmd(_adapter *adapter, struct sta_info *sta);
602 u8 session_tracker_add_cmd(_adapter *adapter, struct sta_info *sta, u8 *local_naddr, u8 *local_port, u8 *remote_naddr, u8 *remote_port);
603 u8 session_tracker_del_cmd(_adapter *adapter, struct sta_info *sta, u8 *local_naddr, u8 *local_port, u8 *remote_naddr, u8 *remote_port);
604 
605 u8 set_txq_params_cmd(_adapter *adapter, u32 ac_parm, u8 ac_type);
606 
607 #if defined(CONFIG_RTW_MESH) && defined(RTW_PER_CMD_SUPPORT_FW)
608 u8 rtw_req_per_cmd(_adapter * adapter);
609 #endif
610 #ifdef CONFIG_RTW_TOKEN_BASED_XMIT
611 u8 rtw_tbtx_chk_cmd(_adapter *adapter);
612 u8 rtw_tbtx_token_dispatch_cmd(_adapter *adapter);
613 #endif
614 #ifdef CONFIG_CTRL_TXSS_BY_TP
615 struct txss_cmd_parm {
616 	struct sta_info *sta;
617 	bool tx_1ss;
618 };
619 
620 void rtw_ctrl_txss_update(_adapter *adapter, struct sta_info *sta);
621 u8 rtw_ctrl_txss(_adapter *adapter, struct sta_info *sta, bool tx_1ss);
622 void rtw_ctrl_tx_ss_by_tp(_adapter *adapter, u8 from_timer);
623 
624 #ifdef DBG_CTRL_TXSS
625 void dbg_ctrl_txss(_adapter *adapter, bool tx_1ss);
626 #endif
627 #endif
628 
629 u8 rtw_drvextra_cmd_hdl(_adapter *padapter, unsigned char *pbuf);
630 
631 extern void rtw_disassoc_cmd_callback(_adapter  *padapter, struct cmd_obj *pcmd);
632 extern void rtw_joinbss_cmd_callback(_adapter  *padapter, struct cmd_obj *pcmd);
633 void rtw_create_ibss_post_hdl(_adapter *padapter, int status);
634 extern void rtw_readtssi_cmdrsp_callback(_adapter	*padapter,  struct cmd_obj *pcmd);
635 
636 extern void rtw_setstaKey_cmdrsp_callback(_adapter  *padapter,  struct cmd_obj *pcmd);
637 extern void rtw_getrttbl_cmdrsp_callback(_adapter  *padapter,  struct cmd_obj *pcmd);
638 void rtw_run_cmd(_adapter *padapter, struct cmd_obj *pcmd, bool discard);
639 u32 rtw_get_turbo_edca(_adapter *padapter, u8 aifs, u8 ecwmin, u8 ecwmax, u8 txop);
640 
641 enum rtw_cmd_id {
642 	CMD_JOINBSS, /*0*/
643 	CMD_DISCONNECT, /*1*/
644 	CMD_CREATE_BSS,/*2*/
645 	CMD_SET_OPMODE, /*3*/
646 	CMD_SITE_SURVEY, /*4*/
647 	CMD_SET_AUTH, /*5*/
648 #ifndef CONFIG_CMD_DISP
649 	CMD_SET_KEY, /*6*/
650 	CMD_SET_STAKEY, /*7*/
651 #endif
652 	CMD_ADD_BAREQ, /*8*/
653 	CMD_SET_CHANNEL, /*9*/
654 	CMD_TX_BEACON, /*10*/
655 	CMD_SET_MLME_EVT, /*11*/
656 	CMD_SET_DRV_EXTRA, /*12*/
657 	CMD_SET_CHANPLAN, /*13*/
658 	CMD_LEDBLINK, /*14*/
659 	CMD_SET_CHANSWITCH, /*15*/
660 	CMD_TDLS, /*16*/
661 	CMD_CHK_BMCSLEEPQ,  /*17*/
662 	CMD_RUN_INTHREAD, /*18*/
663 	CMD_ADD_BARSP, /*19*/
664 	CMD_RM_POST_EVENT, /*20*/
665 	CMD_SET_MESH_PLINK_STATE, /* 21 */
666 	CMD_DELBA, /* 22 */
667 	CMD_GET_CHANPLAN, /*23*/
668 	CMD_ID_MAX
669 };
670 
671 #define CMD_FMT "cmd=%d,%d,%d"
672 #define CMD_ARG(cmd) \
673 	(cmd)->cmdcode, \
674 	(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), \
675 	(cmd)->cmdcode == CMD_SET_DRV_EXTRA ? ((struct drvextra_cmd_parm *)(cmd)->parmbuf)->type : 0
676 
677 #ifdef CONFIG_CMD_GENERAL
678 void rtw_dynamic_chk_wk_sw_hdl(_adapter *padapter);
679 void rtw_dynamic_chk_wk_hw_hdl(_adapter *padapter);
680 #else
681 void rtw_dynamic_chk_wk_hdl(_adapter *padapter);
682 #endif
683 #endif /* _CMD_H_ */
684