xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/rockchip_wlan/rtl8821cs/include/rtw_xmit.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /******************************************************************************
3  *
4  * Copyright(c) 2007 - 2019 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_XMIT_H_
17 #define _RTW_XMIT_H_
18 
19 
20 #if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
21 	#ifdef CONFIG_TX_AGGREGATION
22 		#ifdef CONFIG_RTL8822C
23 			#ifdef CONFIG_SDIO_TX_FORMAT_DUMMY_AUTO
24 				#define MAX_XMITBUF_SZ	(51200)
25 			#else
26 				#define MAX_XMITBUF_SZ	(32764)
27 			#endif
28 		#else
29 			#define MAX_XMITBUF_SZ	(20480)	/* 20k */
30 		#endif
31 		/* #define SDIO_TX_AGG_MAX	5 */
32 	#else
33 		#define MAX_XMITBUF_SZ (1664)
34 		#define SDIO_TX_AGG_MAX	1
35 	#endif
36 
37 	#if defined CONFIG_SDIO_HCI
38 		#define NR_XMITBUFF	(16)
39 		#define SDIO_TX_DIV_NUM (2)
40 	#endif
41 	#if defined(CONFIG_GSPI_HCI)
42 		#define NR_XMITBUFF	(128)
43 	#endif
44 
45 #elif defined (CONFIG_USB_HCI)
46 
47 	#ifdef CONFIG_USB_TX_AGGREGATION
48 		#if defined(CONFIG_PLATFORM_ARM_SUNxI) || defined(CONFIG_PLATFORM_ARM_SUN6I) || defined(CONFIG_PLATFORM_ARM_SUN7I) || defined(CONFIG_PLATFORM_ARM_SUN8I) || defined(CONFIG_PLATFORM_ARM_SUN50IW1P1)
49 			#define MAX_XMITBUF_SZ (12288)  /* 12k 1536*8 */
50 		#elif defined (CONFIG_PLATFORM_MSTAR)
51 			#define MAX_XMITBUF_SZ	7680	/* 7.5k */
52 		#else
53 			#define MAX_XMITBUF_SZ	(20480)	/* 20k */
54 		#endif
55 	#else
56 		#define MAX_XMITBUF_SZ	(2048)
57 	#endif
58 
59 	#ifdef CONFIG_SINGLE_XMIT_BUF
60 		#define NR_XMITBUFF	(1)
61 	#else
62 		#define NR_XMITBUFF	(4)
63 	#endif /* CONFIG_SINGLE_XMIT_BUF */
64 #elif defined (CONFIG_PCI_HCI)
65 #ifdef CONFIG_TX_AMSDU
66 	#define MAX_XMITBUF_SZ	(3500)
67 #else
68 	#define MAX_XMITBUF_SZ	(1664)
69 #endif
70 #ifdef CONFIG_PCI_TX_POLLING
71 	#define NR_XMITBUFF	(256)
72 #else
73 	#define NR_XMITBUFF	(128)
74 #endif
75 #endif
76 
77 
78 #ifdef CONFIG_PCI_HCI
79 	#define XMITBUF_ALIGN_SZ 4
80 #else
81 	#ifdef USB_XMITBUF_ALIGN_SZ
82 		#define XMITBUF_ALIGN_SZ (USB_XMITBUF_ALIGN_SZ)
83 	#else
84 		#define XMITBUF_ALIGN_SZ 512
85 	#endif
86 #endif
87 
88 
89 /* xmit extension buff defination */
90 #define MAX_XMIT_EXTBUF_SZ	(1536)
91 
92 #ifdef CONFIG_SINGLE_XMIT_BUF
93 	#define NR_XMIT_EXTBUFF	(1)
94 #else
95 	#define NR_XMIT_EXTBUFF	(32)
96 #endif
97 
98 #ifdef CONFIG_RTL8812A
99 	#define MAX_CMDBUF_SZ	(512 * 18)
100 #elif defined(CONFIG_RTL8723D) && defined(CONFIG_LPS_POFF)
101 	#define MAX_CMDBUF_SZ	(128*70) /*(8960)*/
102 #elif defined(CONFIG_RTL8822C) && defined(CONFIG_WAR_OFFLOAD)
103 	#define MAX_CMDBUF_SZ	(128*128) /*(16k) */
104 #else
105 	#define MAX_CMDBUF_SZ	(5120)	/* (4096) */
106 #endif
107 
108 #define MAX_BEACON_LEN	512
109 
110 #define MAX_NUMBLKS		(1)
111 
112 #define XMIT_VO_QUEUE (0)
113 #define XMIT_VI_QUEUE (1)
114 #define XMIT_BE_QUEUE (2)
115 #define XMIT_BK_QUEUE (3)
116 
117 #define VO_QUEUE_INX		0
118 #define VI_QUEUE_INX		1
119 #define BE_QUEUE_INX		2
120 #define BK_QUEUE_INX		3
121 #define BCN_QUEUE_INX		4
122 #define MGT_QUEUE_INX		5
123 #define TXCMD_QUEUE_INX		6
124 #define HIGH_QUEUE_INX		7
125 /* keep high queue to be the last one, so we can extend HIQ to port 1, 2, ... */
126 
127 #ifndef CONFIG_PORT_BASED_HIQ
128 #define HW_QUEUE_ENTRY	8
129 #else
130 #define HI_QUEUE_INX(n)	(HIGH_QUEUE_INX + (n))
131 #define HW_QUEUE_ENTRY	(8 + CONFIG_IFACE_NUMBER - 1)
132 #endif
133 
134 #ifdef CONFIG_PCI_HCI
135 	#ifdef CONFIG_TRX_BD_ARCH
136 		#define TX_BD_NUM			(128+1)	/* +1 result from ring buffer */
137 	#else
138 		#define TXDESC_NUM			128
139 	#endif
140 #endif
141 
142 #define WEP_IV(pattrib_iv, dot11txpn, keyidx)\
143 	do {\
144 		dot11txpn.val = (dot11txpn.val == 0xffffff) ? 0 : (dot11txpn.val + 1);\
145 		pattrib_iv[0] = dot11txpn._byte_.TSC0;\
146 		pattrib_iv[1] = dot11txpn._byte_.TSC1;\
147 		pattrib_iv[2] = dot11txpn._byte_.TSC2;\
148 		pattrib_iv[3] = ((keyidx & 0x3)<<6);\
149 	} while (0)
150 
151 
152 #define TKIP_IV(pattrib_iv, dot11txpn, keyidx)\
153 	do {\
154 		dot11txpn.val = dot11txpn.val == 0xffffffffffffULL ? 0 : (dot11txpn.val + 1);\
155 		pattrib_iv[0] = dot11txpn._byte_.TSC1;\
156 		pattrib_iv[1] = (dot11txpn._byte_.TSC1 | 0x20) & 0x7f;\
157 		pattrib_iv[2] = dot11txpn._byte_.TSC0;\
158 		pattrib_iv[3] = BIT(5) | ((keyidx & 0x3)<<6);\
159 		pattrib_iv[4] = dot11txpn._byte_.TSC2;\
160 		pattrib_iv[5] = dot11txpn._byte_.TSC3;\
161 		pattrib_iv[6] = dot11txpn._byte_.TSC4;\
162 		pattrib_iv[7] = dot11txpn._byte_.TSC5;\
163 	} while (0)
164 
165 #define AES_IV(pattrib_iv, dot11txpn, keyidx)\
166 	do {\
167 		dot11txpn.val = dot11txpn.val == 0xffffffffffffULL ? 0 : (dot11txpn.val + 1);\
168 		pattrib_iv[0] = dot11txpn._byte_.TSC0;\
169 		pattrib_iv[1] = dot11txpn._byte_.TSC1;\
170 		pattrib_iv[2] = 0;\
171 		pattrib_iv[3] = BIT(5) | ((keyidx & 0x3)<<6);\
172 		pattrib_iv[4] = dot11txpn._byte_.TSC2;\
173 		pattrib_iv[5] = dot11txpn._byte_.TSC3;\
174 		pattrib_iv[6] = dot11txpn._byte_.TSC4;\
175 		pattrib_iv[7] = dot11txpn._byte_.TSC5;\
176 	} while (0)
177 
178 #define GCMP_IV(a, b, c) AES_IV(a, b, c)
179 
180 /* Check if AMPDU Tx is supported or not. If it is supported,
181 * it need to check "amsdu in ampdu" is supported or not.
182 * (ampdu_en, amsdu_ampdu_en) =
183 * (0, x) : AMPDU is not enable, but AMSDU is valid to send.
184 * (1, 0) : AMPDU is enable, AMSDU in AMPDU is not enable. So, AMSDU is not valid to send.
185 * (1, 1) : AMPDU and AMSDU in AMPDU are enable. So, AMSDU is valid to send.
186 */
187 #define IS_AMSDU_AMPDU_NOT_VALID(pattrib)\
188 	 ((pattrib->ampdu_en == _TRUE) && (pattrib->amsdu_ampdu_en == _FALSE))
189 
190 #define IS_AMSDU_AMPDU_VALID(pattrib)\
191 	 !((pattrib->ampdu_en == _TRUE) && (pattrib->amsdu_ampdu_en == _FALSE))
192 
193 #ifdef CONFIG_RTW_MGMT_QUEUE
194 #define HWXMIT_ENTRY 5
195 #else
196 #define HWXMIT_ENTRY 4
197 #endif
198 
199 /* For Buffer Descriptor ring architecture */
200 #if defined(BUF_DESC_ARCH) || defined(CONFIG_TRX_BD_ARCH)
201 	#if defined(CONFIG_RTL8192E)
202 		#define TX_BUFFER_SEG_NUM	1 /* 0:2 seg, 1: 4 seg, 2: 8 seg. */
203 	#elif defined(CONFIG_RTL8814A)
204 		#define TX_BUFFER_SEG_NUM	1 /* 0:2 seg, 1: 4 seg, 2: 8 seg. */
205 	#else
206 		#define TX_BUFFER_SEG_NUM	1 /* 0:2 seg, 1: 4 seg, 2: 8 seg. */
207 	#endif
208 #endif
209 
210 #if defined(CONFIG_RTL8812A) || defined(CONFIG_RTL8821A) ||\
211 	defined(CONFIG_RTL8723B) || defined(CONFIG_RTL8192E) ||\
212 	defined(CONFIG_RTL8814A) || defined(CONFIG_RTL8703B) ||\
213 	defined(CONFIG_RTL8188F) || defined(CONFIG_RTL8188GTV) || defined(CONFIG_RTL8723D) ||\
214 	defined(CONFIG_RTL8710B) || defined(CONFIG_RTL8192F) ||\
215 	defined(CONFIG_RTL8723F)
216 	#define TXDESC_SIZE 40
217 #elif defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8822C)
218 	#define TXDESC_SIZE 48		/* HALMAC_TX_DESC_SIZE_8822B */
219 #elif defined(CONFIG_RTL8821C)
220 	#define TXDESC_SIZE 48		/* HALMAC_TX_DESC_SIZE_8821C */
221 #elif defined(CONFIG_RTL8814B)
222 	#define TXDESC_SIZE (16 + 32)
223 #else
224 	#define TXDESC_SIZE 32 /* old IC (ex: 8188E) */
225 #endif
226 
227 #ifdef CONFIG_TX_EARLY_MODE
228 	#define EARLY_MODE_INFO_SIZE	8
229 #endif
230 
231 
232 #if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
233 	#define TXDESC_OFFSET TXDESC_SIZE
234 #endif
235 
236 #ifdef CONFIG_USB_HCI
237 	#ifdef USB_PACKET_OFFSET_SZ
238 		#define PACKET_OFFSET_SZ (USB_PACKET_OFFSET_SZ)
239 	#else
240 		#define PACKET_OFFSET_SZ (8)
241 	#endif
242 	#define TXDESC_OFFSET (TXDESC_SIZE + PACKET_OFFSET_SZ)
243 #endif
244 
245 #ifdef CONFIG_PCI_HCI
246 	#if defined(CONFIG_RTL8192E) || defined(CONFIG_RTL8814A) || defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C) || defined(CONFIG_RTL8822C) || defined(CONFIG_TRX_BD_ARCH)
247 		/* this section is defined for buffer descriptor ring architecture */
248 		#define TX_WIFI_INFO_SIZE (TXDESC_SIZE) /* it may add 802.11 hdr or others... */
249 		/* tx desc and payload are in the same buf */
250 		#define TXDESC_OFFSET (TX_WIFI_INFO_SIZE)
251 	#else
252 		/* tx desc and payload are NOT in the same buf */
253 		#define TXDESC_OFFSET (0)
254 		/* 8188ee/8723be/8812ae/8821ae has extra PCI DMA info in tx desc */
255 		#define TX_DESC_NEXT_DESC_OFFSET	(TXDESC_SIZE + 8)
256 	#endif
257 #endif /* CONFIG_PCI_HCI */
258 
259 enum TXDESC_SC {
260 	SC_DONT_CARE = 0x00,
261 	SC_UPPER = 0x01,
262 	SC_LOWER = 0x02,
263 	SC_DUPLICATE = 0x03
264 };
265 
266 #ifdef CONFIG_PCI_HCI
267 	#ifndef CONFIG_TRX_BD_ARCH	/* CONFIG_TRX_BD_ARCH doesn't need this */
268 		#define TXDESC_64_BYTES
269 	#endif
270 #elif defined(CONFIG_RTL8812A) || defined(CONFIG_RTL8821A) || defined(CONFIG_RTL8723B) \
271 	|| defined(CONFIG_RTL8188F) || defined(CONFIG_RTL8188GTV) || defined(CONFIG_RTL8723D) \
272 	|| defined(CONFIG_RTL8192F) || defined(CONFIG_RTL8723F)
273 	#define TXDESC_40_BYTES
274 #endif
275 
276 #ifdef CONFIG_TRX_BD_ARCH
277 struct tx_buf_desc {
278 #ifdef CONFIG_64BIT_DMA
279 #define TX_BUFFER_SEG_SIZE	4	/* in unit of DWORD */
280 #else
281 #define TX_BUFFER_SEG_SIZE	2	/* in unit of DWORD */
282 #endif
283 	unsigned int dword[TX_BUFFER_SEG_SIZE * (2 << TX_BUFFER_SEG_NUM)];
284 } __packed;
285 #elif (defined(CONFIG_RTL8192E) || defined(CONFIG_RTL8814A) || defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8822C)) && defined(CONFIG_PCI_HCI) /* 8192ee or 8814ae */
286 /* 8192EE_TODO */
287 struct tx_desc {
288 	unsigned int txdw0;
289 	unsigned int txdw1;
290 	unsigned int txdw2;
291 	unsigned int txdw3;
292 	unsigned int txdw4;
293 	unsigned int txdw5;
294 	unsigned int txdw6;
295 	unsigned int txdw7;
296 };
297 #else
298 struct tx_desc {
299 	unsigned int txdw0;
300 	unsigned int txdw1;
301 	unsigned int txdw2;
302 	unsigned int txdw3;
303 	unsigned int txdw4;
304 	unsigned int txdw5;
305 	unsigned int txdw6;
306 	unsigned int txdw7;
307 
308 #if defined(TXDESC_40_BYTES) || defined(TXDESC_64_BYTES)
309 	unsigned int txdw8;
310 	unsigned int txdw9;
311 #endif /* TXDESC_40_BYTES */
312 
313 #ifdef TXDESC_64_BYTES
314 	unsigned int txdw10;
315 	unsigned int txdw11;
316 
317 	/* 2008/05/15 MH Because PCIE HW memory R/W 4K limit. And now,  our descriptor */
318 	/* size is 40 bytes. If you use more than 102 descriptor( 103*40>4096), HW will execute */
319 	/* memoryR/W CRC error. And then all DMA fetch will fail. We must decrease descriptor */
320 	/* number or enlarge descriptor size as 64 bytes. */
321 	unsigned int txdw12;
322 	unsigned int txdw13;
323 	unsigned int txdw14;
324 	unsigned int txdw15;
325 #endif
326 };
327 #endif
328 
329 #ifndef CONFIG_TRX_BD_ARCH
330 union txdesc {
331 	struct tx_desc txdesc;
332 	unsigned int value[TXDESC_SIZE >> 2];
333 };
334 #endif
335 
336 #ifdef CONFIG_PCI_HCI
337 #define PCI_MAX_TX_QUEUE_COUNT	HW_QUEUE_ENTRY
338 
339 struct rtw_tx_ring {
340 	unsigned char	qid;
341 #ifdef CONFIG_TRX_BD_ARCH
342 	struct tx_buf_desc	*buf_desc;
343 #else
344 	struct tx_desc	*desc;
345 #endif
346 	dma_addr_t	dma;
347 	unsigned int	idx;
348 	unsigned int	entries;
349 	_queue		queue;
350 	u32		qlen;
351 #ifdef CONFIG_TRX_BD_ARCH
352 	u16		hw_rp_cache;
353 #endif
354 };
355 
356 #ifdef DBG_TXBD_DESC_DUMP
357 
358 #define TX_BAK_FRMAE_CNT	10
359 #define TX_BAK_DESC_LEN	48	/* byte */
360 #define TX_BAK_DATA_LEN		30	/* byte */
361 
362 struct rtw_tx_desc_backup {
363 	int tx_bak_rp;
364 	int tx_bak_wp;
365 	u8 tx_bak_desc[TX_BAK_DESC_LEN];
366 	u8 tx_bak_data_hdr[TX_BAK_DATA_LEN];
367 	u8 tx_desc_size;
368 };
369 #endif
370 #endif
371 
372 struct	hw_xmit	{
373 	/* _lock xmit_lock; */
374 	/* _list	pending; */
375 	_queue *sta_queue;
376 	/* struct hw_txqueue *phwtxqueue; */
377 	/* sint	txcmdcnt; */
378 	int	accnt;
379 };
380 
381 struct pkt_attrib {
382 	u8	type;
383 	u8	subtype;
384 	u8	bswenc;
385 	u8	dhcp_pkt;
386 	u16	ether_type;
387 	u16	seqnum;
388 	u8	hw_ssn_sel;	/* for HW_SEQ0,1,2,3 */
389 	u16	pkt_hdrlen;	/* the original 802.3 pkt header len */
390 	u16	hdrlen;		/* the WLAN Header Len */
391 	u32	pktlen;		/* the original 802.3 pkt raw_data len (not include ether_hdr data) */
392 	u32	last_txcmdsz;
393 	u8	nr_frags;
394 	u8	encrypt;	/* when 0 indicate no encrypt. when non-zero, indicate the encrypt algorith */
395 	u8	bmc_camid;
396 	u8	iv_len;
397 	u8	icv_len;
398 	u8	iv[18];
399 	u8	icv[16];
400 	u8	priority;
401 	u8	ack_policy;
402 	u8	mac_id;
403 	u8	vcs_mode;	/* virtual carrier sense method */
404 	u8	dst[ETH_ALEN];
405 	u8	src[ETH_ALEN];
406 	u8	ta[ETH_ALEN];
407 	u8	ra[ETH_ALEN];
408 #ifdef CONFIG_RTW_WDS
409 	u8	wds;
410 #endif
411 #ifdef CONFIG_RTW_MESH
412 	u8	mda[ETH_ALEN];	/* mesh da */
413 	u8	msa[ETH_ALEN];	/* mesh sa */
414 	u8	meshctrl_len;	/* Length of Mesh Control field */
415 	u8	mesh_frame_mode;
416 	#if CONFIG_RTW_MESH_DATA_BMC_TO_UC
417 	u8 mb2u;
418 	#endif
419 	u8 mfwd_ttl;
420 	u32 mseq;
421 #endif
422 #ifdef CONFIG_TCP_CSUM_OFFLOAD_TX
423 	u8	hw_csum;
424 #endif
425 	u8	key_idx;
426 	u8	qos_en;
427 	u8	ht_en;
428 	u8	raid;/* rate adpative id */
429 	u8	bwmode;
430 	u8	ch_offset;/* PRIME_CHNL_OFFSET */
431 	u8	sgi;/* short GI */
432 	u8	ampdu_en;/* tx ampdu enable */
433 	u8	ampdu_spacing; /* ampdu_min_spacing for peer sta's rx */
434 	u8	amsdu;
435 	u8	amsdu_ampdu_en;/* tx amsdu in ampdu enable */
436 	u8	mdata;/* more data bit */
437 	u8	pctrl;/* per packet txdesc control enable */
438 	u8	triggered;/* for ap mode handling Power Saving sta */
439 	u8	qsel;
440 	u8	order;/* order bit */
441 	u8	eosp;
442 	u8	rate;
443 	u8	intel_proxim;
444 	u8	retry_ctrl;
445 	u8   mbssid;
446 	u8	ldpc;
447 	u8	stbc;
448 #ifdef CONFIG_WMMPS_STA
449 	u8	trigger_frame;
450 #endif /* CONFIG_WMMPS_STA */
451 
452 	struct sta_info *psta;
453 
454 	u8 rtsen;
455 	u8 cts2self;
456 	union Keytype	dot11tkiptxmickey;
457 	/* union Keytype	dot11tkiprxmickey; */
458 	union Keytype	dot118021x_UncstKey;
459 
460 #ifdef CONFIG_TDLS
461 	u8 direct_link;
462 	struct sta_info *ptdls_sta;
463 #endif /* CONFIG_TDLS */
464 	u8 key_type;
465 
466 	u8 icmp_pkt;
467 	u8 hipriority_pkt; /* high priority packet */
468 
469 #ifdef CONFIG_BEAMFORMING
470 	u16 txbf_p_aid;/*beamforming Partial_AID*/
471 	u16 txbf_g_id;/*beamforming Group ID*/
472 
473 	/*
474 	 * 2'b00: Unicast NDPA
475 	 * 2'b01: Broadcast NDPA
476 	 * 2'b10: Beamforming Report Poll
477 	 * 2'b11: Final Beamforming Report Poll
478 	 */
479 	u8 bf_pkt_type;
480 #endif
481 
482 #ifdef CONFIG_RTW_MGMT_QUEUE
483 	u8 ps_dontq; /* 1: this frame can't be queued at PS state */
484 #endif
485 };
486 
487 #ifdef CONFIG_RTW_WDS
488 #define XATTRIB_GET_WDS(xattrib) ((xattrib)->wds)
489 #else
490 #define XATTRIB_GET_WDS(xattrib) 0
491 #endif
492 
493 #ifdef CONFIG_RTW_MESH
494 #define XATTRIB_GET_MCTRL_LEN(xattrib) ((xattrib)->meshctrl_len)
495 #else
496 #define XATTRIB_GET_MCTRL_LEN(xattrib) 0
497 #endif
498 
499 #ifdef CONFIG_TX_AMSDU
500 enum {
501 	RTW_AMSDU_TIMER_UNSET = 0,
502 	RTW_AMSDU_TIMER_SETTING,
503 	RTW_AMSDU_TIMER_TIMEOUT,
504 };
505 #endif
506 
507 #define WLANHDR_OFFSET	64
508 
509 #define NULL_FRAMETAG		(0x0)
510 #define DATA_FRAMETAG		0x01
511 #define L2_FRAMETAG		0x02
512 #define MGNT_FRAMETAG		0x03
513 #define AMSDU_FRAMETAG	0x04
514 
515 #define EII_FRAMETAG		0x05
516 #define IEEE8023_FRAMETAG  0x06
517 
518 #define MP_FRAMETAG		0x07
519 
520 #define TXAGG_FRAMETAG	0x08
521 
522 enum {
523 	XMITBUF_DATA = 0,
524 	XMITBUF_MGNT = 1,
525 	XMITBUF_CMD = 2,
526 };
527 
528 bool rtw_xmit_ac_blocked(_adapter *adapter);
529 
530 struct  submit_ctx {
531 	systime submit_time; /* */
532 	u32 timeout_ms; /* <0: not synchronous, 0: wait forever, >0: up to ms waiting */
533 	int status; /* status for operation */
534 #ifdef PLATFORM_LINUX
535 	struct completion done;
536 #endif
537 };
538 
539 enum {
540 	RTW_SCTX_SUBMITTED = -1,
541 	RTW_SCTX_DONE_SUCCESS = 0,
542 	RTW_SCTX_DONE_UNKNOWN,
543 	RTW_SCTX_DONE_TIMEOUT,
544 	RTW_SCTX_DONE_BUF_ALLOC,
545 	RTW_SCTX_DONE_BUF_FREE,
546 	RTW_SCTX_DONE_WRITE_PORT_ERR,
547 	RTW_SCTX_DONE_TX_DESC_NA,
548 	RTW_SCTX_DONE_TX_DENY,
549 	RTW_SCTX_DONE_CCX_PKT_FAIL,
550 	RTW_SCTX_DONE_DRV_STOP,
551 	RTW_SCTX_DONE_DEV_REMOVE,
552 	RTW_SCTX_DONE_CMD_ERROR,
553 	RTW_SCTX_DONE_CMD_DROP,
554 	RTX_SCTX_CSTR_WAIT_RPT2,
555 };
556 
557 
558 void rtw_sctx_init(struct submit_ctx *sctx, int timeout_ms);
559 int rtw_sctx_wait(struct submit_ctx *sctx, const char *msg);
560 void rtw_sctx_done_err(struct submit_ctx **sctx, int status);
561 void rtw_sctx_done(struct submit_ctx **sctx);
562 
563 struct xmit_buf {
564 	_list	list;
565 
566 	_adapter *padapter;
567 
568 	u8 *pallocated_buf;
569 
570 	u8 *pbuf;
571 
572 	void *priv_data;
573 
574 	u16 buf_tag; /* 0: Normal xmitbuf, 1: extension xmitbuf, 2:cmd xmitbuf */
575 	u16 flags;
576 	u32 alloc_sz;
577 
578 	u32  len;
579 
580 	struct submit_ctx *sctx;
581 
582 #ifdef CONFIG_USB_HCI
583 
584 	/* u32 sz[8]; */
585 	u32	ff_hwaddr;
586 #ifdef RTW_HALMAC
587 	u8 bulkout_id; /* for halmac */
588 #endif /* RTW_HALMAC */
589 
590 	PURB	pxmit_urb[8];
591 	dma_addr_t dma_transfer_addr;	/* (in) dma addr for transfer_buffer */
592 
593 	u8 bpending[8];
594 
595 	sint last[8];
596 
597 #endif
598 
599 #if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
600 	u8 *phead;
601 	u8 *pdata;
602 	u8 *ptail;
603 	u8 *pend;
604 	u32 ff_hwaddr;
605 	u8	pg_num;
606 	u8	agg_num;
607 #endif
608 
609 #ifdef CONFIG_PCI_HCI
610 #ifdef CONFIG_TRX_BD_ARCH
611 	/*struct tx_buf_desc *buf_desc;*/
612 #else
613 	struct tx_desc *desc;
614 #endif
615 #endif
616 
617 #if defined(DBG_XMIT_BUF) || defined(DBG_XMIT_BUF_EXT)
618 	u8 no;
619 #endif
620 
621 };
622 
623 
624 struct xmit_frame {
625 	_list	list;
626 
627 	struct pkt_attrib attrib;
628 
629 	u16 os_qid;
630 	_pkt *pkt;
631 
632 	int	frame_tag;
633 
634 	_adapter *padapter;
635 
636 	u8	*buf_addr;
637 
638 	struct xmit_buf *pxmitbuf;
639 
640 #if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
641 	u8	pg_num;
642 	u8	agg_num;
643 #endif
644 
645 #ifdef CONFIG_USB_HCI
646 #ifdef CONFIG_USB_TX_AGGREGATION
647 	u8	agg_num;
648 #endif
649 	s8	pkt_offset;
650 #endif
651 
652 #ifdef CONFIG_XMIT_ACK
653 	u8 ack_report;
654 #endif
655 
656 	u8 *alloc_addr; /* the actual address this xmitframe allocated */
657 	u8 ext_tag; /* 0:data, 1:mgmt */
658 
659 };
660 
661 struct tx_servq {
662 	_list	tx_pending;
663 	_queue	sta_pending;
664 	int qcnt;
665 };
666 
667 
668 struct sta_xmit_priv {
669 	_lock	lock;
670 	sint	option;
671 	sint	apsd_setting;	/* When bit mask is on, the associated edca queue supports APSD. */
672 
673 
674 	/* struct tx_servq blk_q[MAX_NUMBLKS]; */
675 	struct tx_servq	be_q;			/* priority == 0,3 */
676 	struct tx_servq	bk_q;			/* priority == 1,2 */
677 	struct tx_servq	vi_q;			/* priority == 4,5 */
678 	struct tx_servq	vo_q;			/* priority == 6,7 */
679 #ifdef CONFIG_RTW_MGMT_QUEUE
680 	struct tx_servq	mgmt_q;
681 #endif
682 
683 	_list	legacy_dz;
684 	_list  apsd;
685 
686 	u16 txseq_tid[16];
687 
688 	/* uint	sta_tx_bytes; */
689 	/* u64	sta_tx_pkts; */
690 	/* uint	sta_tx_fail; */
691 
692 
693 };
694 
695 
696 struct	hw_txqueue	{
697 	volatile sint	head;
698 	volatile sint	tail;
699 	volatile sint 	free_sz;	/* in units of 64 bytes */
700 	volatile sint      free_cmdsz;
701 	volatile sint	 txsz[8];
702 	uint	ff_hwaddr;
703 	uint	cmd_hwaddr;
704 	sint	ac_tag;
705 };
706 
707 struct agg_pkt_info {
708 	u16 offset;
709 	u16 pkt_len;
710 };
711 
712 enum cmdbuf_type {
713 	CMDBUF_BEACON = 0x00,
714 	CMDBUF_RSVD,
715 	CMDBUF_MAX
716 };
717 
718 u8 rtw_get_hwseq_no(_adapter *padapter);
719 
720 struct	xmit_priv	{
721 
722 	_lock	lock;
723 
724 	_sema	xmit_sema;
725 
726 	/* _queue	blk_strms[MAX_NUMBLKS]; */
727 	_queue	be_pending;
728 	_queue	bk_pending;
729 	_queue	vi_pending;
730 	_queue	vo_pending;
731 	_queue	mgmt_pending;
732 
733 	/* _queue	legacy_dz_queue; */
734 	/* _queue	apsd_queue; */
735 
736 	u8 *pallocated_frame_buf;
737 	u8 *pxmit_frame_buf;
738 	uint free_xmitframe_cnt;
739 	_queue	free_xmit_queue;
740 
741 	/* uint mapping_addr; */
742 	/* uint pkt_sz; */
743 
744 	u8 *xframe_ext_alloc_addr;
745 	u8 *xframe_ext;
746 	uint free_xframe_ext_cnt;
747 	_queue free_xframe_ext_queue;
748 
749 	/* struct	hw_txqueue	be_txqueue; */
750 	/* struct	hw_txqueue	bk_txqueue; */
751 	/* struct	hw_txqueue	vi_txqueue; */
752 	/* struct	hw_txqueue	vo_txqueue; */
753 	/* struct	hw_txqueue	bmc_txqueue; */
754 
755 	uint	frag_len;
756 
757 	_adapter	*adapter;
758 
759 	u8   vcs_setting;
760 	u8	vcs;
761 	u8	vcs_type;
762 	/* u16  rts_thresh; */
763 
764 	u64	tx_bytes;
765 	u64	tx_pkts;
766 	u64	tx_drop;
767 	u64	last_tx_pkts;
768 
769 	struct hw_xmit *hwxmits;
770 	u8	hwxmit_entry;
771 
772 	u8	wmm_para_seq[4];/* sequence for wmm ac parameter strength from large to small. it's value is 0->vo, 1->vi, 2->be, 3->bk. */
773 
774 #ifdef CONFIG_USB_HCI
775 	_sema	tx_retevt;/* all tx return event; */
776 	u8		txirp_cnt;
777 
778 	_tasklet xmit_tasklet;
779 
780 	/* per AC pending irp */
781 	int beq_cnt;
782 	int bkq_cnt;
783 	int viq_cnt;
784 	int voq_cnt;
785 
786 #endif
787 
788 #ifdef CONFIG_PCI_HCI
789 	/* Tx */
790 	struct rtw_tx_ring	tx_ring[PCI_MAX_TX_QUEUE_COUNT];
791 	int	txringcount[PCI_MAX_TX_QUEUE_COUNT];
792 	u8 	beaconDMAing;		/* flag of indicating beacon is transmiting to HW by DMA */
793 	_tasklet xmit_tasklet;
794 #endif
795 
796 #if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
797 #ifdef CONFIG_SDIO_TX_TASKLET
798 	_tasklet xmit_tasklet;
799 #else
800 	_thread_hdl_	SdioXmitThread;
801 	_sema		SdioXmitSema;
802 	#ifdef SDIO_FREE_XMIT_BUF_SEMA
803 	_sema		sdio_free_xmitbuf_sema;
804 	#endif
805 #endif /* CONFIG_SDIO_TX_TASKLET */
806 #endif /* CONFIG_SDIO_HCI */
807 
808 	_queue free_xmitbuf_queue;
809 	_queue pending_xmitbuf_queue;
810 	u8 *pallocated_xmitbuf;
811 	u8 *pxmitbuf;
812 	uint free_xmitbuf_cnt;
813 
814 	_queue free_xmit_extbuf_queue;
815 	u8 *pallocated_xmit_extbuf;
816 	u8 *pxmit_extbuf;
817 	uint free_xmit_extbuf_cnt;
818 
819 	struct xmit_buf	pcmd_xmitbuf[CMDBUF_MAX];
820 	u8   hw_ssn_seq_no;/* mapping to REG_HW_SEQ 0,1,2,3 */
821 	u16	nqos_ssn;
822 #ifdef CONFIG_TX_EARLY_MODE
823 
824 #ifdef CONFIG_SDIO_HCI
825 #define MAX_AGG_PKT_NUM 20
826 #else
827 #define MAX_AGG_PKT_NUM 256 /* Max tx ampdu coounts		 */
828 #endif
829 
830 	struct agg_pkt_info agg_pkt[MAX_AGG_PKT_NUM];
831 #endif
832 
833 #ifdef CONFIG_XMIT_ACK
834 	int	ack_tx;
835 	_mutex ack_tx_mutex;
836 	struct submit_ctx ack_tx_ops;
837 	u8 seq_no;
838 #ifdef CONFIG_REMOVE_DUP_TX_STATE
839 	u8 retry_count;
840 #endif
841 #endif
842 
843 #ifdef CONFIG_TX_AMSDU
844 	_timer amsdu_vo_timer;
845 	u8 amsdu_vo_timeout;
846 
847 	_timer amsdu_vi_timer;
848 	u8 amsdu_vi_timeout;
849 
850 	_timer amsdu_be_timer;
851 	u8 amsdu_be_timeout;
852 
853 	_timer amsdu_bk_timer;
854 	u8 amsdu_bk_timeout;
855 
856 	u32 amsdu_debug_set_timer;
857 	u32 amsdu_debug_timeout;
858 	u32 amsdu_debug_coalesce_one;
859 	u32 amsdu_debug_coalesce_two;
860 
861 #endif
862 #ifdef DBG_TXBD_DESC_DUMP
863 	BOOLEAN	 dump_txbd_desc;
864 #endif
865 #ifdef CONFIG_PCI_TX_POLLING
866 	_timer tx_poll_timer;
867 #endif
868 	_lock lock_sctx;
869 
870 };
871 
872 extern struct xmit_frame *__rtw_alloc_cmdxmitframe(struct xmit_priv *pxmitpriv,
873 		enum cmdbuf_type buf_type);
874 #define rtw_alloc_cmdxmitframe(p) __rtw_alloc_cmdxmitframe(p, CMDBUF_RSVD)
875 #if defined(CONFIG_RTL8192E) && defined(CONFIG_PCI_HCI)
876 extern struct xmit_frame *__rtw_alloc_cmdxmitframe_8192ee(struct xmit_priv *pxmitpriv,
877 		enum cmdbuf_type buf_type);
878 #define rtw_alloc_bcnxmitframe(p) __rtw_alloc_cmdxmitframe_8192ee(p, CMDBUF_BEACON)
879 #elif defined(CONFIG_RTL8822B) && defined(CONFIG_PCI_HCI)
880 extern struct xmit_frame *__rtw_alloc_cmdxmitframe_8822be(struct xmit_priv *pxmitpriv,
881 		enum cmdbuf_type buf_type);
882 #define rtw_alloc_bcnxmitframe(p) __rtw_alloc_cmdxmitframe_8822be(p, CMDBUF_BEACON)
883 #elif defined(CONFIG_RTL8822C) && defined(CONFIG_PCI_HCI)
884 extern struct xmit_frame *__rtw_alloc_cmdxmitframe_8822ce(struct xmit_priv *pxmitpriv,
885 		enum cmdbuf_type buf_type);
886 #define rtw_alloc_bcnxmitframe(p) __rtw_alloc_cmdxmitframe_8822ce(p, CMDBUF_BEACON)
887 #elif defined(CONFIG_RTL8821C) && defined(CONFIG_PCI_HCI)
888 extern struct xmit_frame *__rtw_alloc_cmdxmitframe_8821ce(struct xmit_priv *pxmitpriv,
889 		enum cmdbuf_type buf_type);
890 #define rtw_alloc_bcnxmitframe(p) __rtw_alloc_cmdxmitframe_8821ce(p, CMDBUF_BEACON)
891 #elif defined(CONFIG_RTL8192F) && defined(CONFIG_PCI_HCI)
892 extern struct xmit_frame *__rtw_alloc_cmdxmitframe_8192fe(struct xmit_priv *pxmitpriv,
893 		enum cmdbuf_type buf_type);
894 #define rtw_alloc_bcnxmitframe(p) __rtw_alloc_cmdxmitframe_8192fe(p, CMDBUF_BEACON)
895 #elif defined(CONFIG_RTL8812A) && defined(CONFIG_PCI_HCI)
896 extern struct xmit_frame *__rtw_alloc_cmdxmitframe_8812ae(struct xmit_priv *pxmitpriv,
897 		enum cmdbuf_type buf_type);
898 #define rtw_alloc_bcnxmitframe(p) __rtw_alloc_cmdxmitframe_8812ae(p, CMDBUF_BEACON)
899 #elif defined(CONFIG_RTL8723D) && defined(CONFIG_PCI_HCI)
900 extern struct xmit_frame *__rtw_alloc_cmdxmitframe_8723de(struct xmit_priv *pxmitpriv,
901 		enum cmdbuf_type buf_type);
902 #define rtw_alloc_bcnxmitframe(p) __rtw_alloc_cmdxmitframe_8723de(p, CMDBUF_BEACON)
903 #elif defined(CONFIG_RTL8723B) && defined(CONFIG_PCI_HCI)
904 extern struct xmit_frame *__rtw_alloc_cmdxmitframe_8723be(struct xmit_priv *pxmitpriv,
905 		enum cmdbuf_type buf_type);
906 #define rtw_alloc_bcnxmitframe(p) __rtw_alloc_cmdxmitframe_8723be(p, CMDBUF_BEACON)
907 #elif defined(CONFIG_RTL8814A) && defined(CONFIG_PCI_HCI)
908 extern struct xmit_frame *__rtw_alloc_cmdxmitframe_8814ae(struct xmit_priv *pxmitpriv,
909 		enum cmdbuf_type buf_type);
910 #define rtw_alloc_bcnxmitframe(p) __rtw_alloc_cmdxmitframe_8814ae(p, CMDBUF_BEACON)
911 #elif defined(CONFIG_RTL8814B) && defined(CONFIG_PCI_HCI)
912 extern struct xmit_frame *__rtw_alloc_cmdxmitframe_8814be(struct xmit_priv *pxmitpriv,
913 		enum cmdbuf_type buf_type);
914 #define rtw_alloc_bcnxmitframe(p) __rtw_alloc_cmdxmitframe_8814be(p, CMDBUF_BEACON)
915 #else
916 #define rtw_alloc_bcnxmitframe(p) __rtw_alloc_cmdxmitframe(p, CMDBUF_BEACON)
917 #endif
918 
919 extern struct xmit_buf *rtw_alloc_xmitbuf_ext(struct xmit_priv *pxmitpriv);
920 extern s32 rtw_free_xmitbuf_ext(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf);
921 
922 extern struct xmit_buf *rtw_alloc_xmitbuf(struct xmit_priv *pxmitpriv);
923 extern s32 rtw_free_xmitbuf(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf);
924 
925 void rtw_count_tx_stats(_adapter *padapter, struct xmit_frame *pxmitframe, int sz);
926 extern void rtw_update_protection(_adapter *padapter, u8 *ie, uint ie_len);
927 
928 extern s32 rtw_make_wlanhdr(_adapter *padapter, u8 *hdr, struct pkt_attrib *pattrib);
929 extern s32 rtw_put_snap(u8 *data, u16 h_proto);
930 
931 extern struct xmit_frame *rtw_alloc_xmitframe(struct xmit_priv *pxmitpriv, u16 os_qid);
932 struct xmit_frame *rtw_alloc_xmitframe_ext(struct xmit_priv *pxmitpriv);
933 struct xmit_frame *rtw_alloc_xmitframe_once(struct xmit_priv *pxmitpriv);
934 extern s32 rtw_free_xmitframe(struct xmit_priv *pxmitpriv, struct xmit_frame *pxmitframe);
935 extern void rtw_free_xmitframe_queue(struct xmit_priv *pxmitpriv, _queue *pframequeue);
936 struct tx_servq *rtw_get_sta_pending(_adapter *padapter, struct sta_info *psta, sint up, u8 *ac);
937 extern s32 rtw_xmitframe_enqueue(_adapter *padapter, struct xmit_frame *pxmitframe);
938 
939 #ifdef CONFIG_RTW_MGMT_QUEUE
940 void rtw_free_mgmt_xmitframe_queue(struct xmit_priv *pxmitpriv, _queue *mgmt_queue);
941 u8 rtw_mgmt_xmitframe_enqueue(_adapter *padapter, struct xmit_frame *pxmitframe);
942 struct xmit_frame *rtw_dequeue_mgmt_xframe(struct xmit_priv *pxmitpriv);
943 #endif /* CONFIG_RTW_MGMT_QUEUE */
944 
945 extern struct xmit_frame *rtw_dequeue_xframe(struct xmit_priv *pxmitpriv, struct hw_xmit *phwxmit_i, sint entry);
946 
947 extern s32 rtw_xmit_classifier(_adapter *padapter, struct xmit_frame *pxmitframe);
948 extern u32 rtw_calculate_wlan_pkt_size_by_attribue(struct pkt_attrib *pattrib);
949 #define rtw_wlan_pkt_size(f) rtw_calculate_wlan_pkt_size_by_attribue(&f->attrib)
950 extern s32 rtw_xmitframe_coalesce(_adapter *padapter, _pkt *pkt, struct xmit_frame *pxmitframe);
951 #if defined(CONFIG_IEEE80211W) || defined(CONFIG_RTW_MESH)
952 extern s32 rtw_mgmt_xmitframe_coalesce(_adapter *padapter, _pkt *pkt, struct xmit_frame *pxmitframe);
953 #endif
954 #ifdef CONFIG_TDLS
955 extern struct tdls_txmgmt *ptxmgmt;
956 s32 rtw_xmit_tdls_coalesce(_adapter *padapter, struct xmit_frame *pxmitframe, struct tdls_txmgmt *ptxmgmt);
957 s32 update_tdls_attrib(_adapter *padapter, struct pkt_attrib *pattrib);
958 #endif
959 s32 _rtw_init_hw_txqueue(struct hw_txqueue *phw_txqueue, u8 ac_tag);
960 void _rtw_init_sta_xmit_priv(struct sta_xmit_priv *psta_xmitpriv);
961 
962 
963 s32 rtw_txframes_pending(_adapter *padapter);
964 s32 rtw_txframes_sta_ac_pending(_adapter *padapter, struct pkt_attrib *pattrib);
965 void rtw_init_hwxmits(struct hw_xmit *phwxmit, sint entry);
966 
967 
968 s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, _adapter *padapter);
969 void _rtw_free_xmit_priv(struct xmit_priv *pxmitpriv);
970 
971 
972 void rtw_alloc_hwxmits(_adapter *padapter);
973 void rtw_free_hwxmits(_adapter *padapter);
974 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24))
975 s32 rtw_monitor_xmit_entry(struct sk_buff *skb, struct net_device *ndev);
976 #endif
977 void rtw_xmit_dequeue_callback(_workitem *work);
978 void rtw_xmit_queue_set(struct sta_info *sta);
979 void rtw_xmit_queue_clear(struct sta_info *sta);
980 s32 rtw_xmit_posthandle(_adapter *padapter, struct xmit_frame *pxmitframe, _pkt *pkt);
981 s32 rtw_xmit(_adapter *padapter, _pkt **pkt, u16 os_qid);
982 bool xmitframe_hiq_filter(struct xmit_frame *xmitframe);
983 #if defined(CONFIG_AP_MODE) || defined(CONFIG_TDLS)
984 #ifdef CONFIG_RTW_MGMT_QUEUE
985 u8 mgmt_xmitframe_enqueue_for_sleeping_sta(_adapter *padapter, struct xmit_frame *pxmitframe);
986 #endif
987 sint xmitframe_enqueue_for_sleeping_sta(_adapter *padapter, struct xmit_frame *pxmitframe);
988 void stop_sta_xmit(_adapter *padapter, struct sta_info *psta);
989 void wakeup_sta_to_xmit(_adapter *padapter, struct sta_info *psta);
990 void xmit_delivery_enabled_frames(_adapter *padapter, struct sta_info *psta);
991 #endif
992 
993 u8 rtw_get_tx_bw_mode(_adapter *adapter, struct sta_info *sta);
994 
995 void rtw_update_tx_rate_bmp(struct dvobj_priv *dvobj);
996 u8 rtw_get_tx_bw_bmp_of_ht_rate(struct dvobj_priv *dvobj, u8 rate, u8 max_bw);
997 u8 rtw_get_tx_bw_bmp_of_vht_rate(struct dvobj_priv *dvobj, u8 rate, u8 max_bw);
998 s16 rtw_adapter_get_oper_txpwr_max_mbm(_adapter *adapter, bool eirp);
999 s16 rtw_rfctl_get_oper_txpwr_max_mbm(struct rf_ctl_t *rfctl, u8 ch, u8 bw, u8 offset, u8 ifbmp_mod, u8 if_op, bool eirp);
1000 s16 rtw_get_oper_txpwr_max_mbm(struct dvobj_priv *dvobj, bool erip);
1001 s16 rtw_rfctl_get_reg_max_txpwr_mbm(struct rf_ctl_t *rfctl, u8 ch, u8 bw, u8 offset, bool eirp);
1002 
1003 u8 query_ra_short_GI(struct sta_info *psta, u8 bw);
1004 
1005 u8	qos_acm(u8 acm_mask, u8 priority);
1006 
1007 #ifdef CONFIG_XMIT_THREAD_MODE
1008 void	enqueue_pending_xmitbuf(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf);
1009 void enqueue_pending_xmitbuf_to_head(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf);
1010 struct xmit_buf	*dequeue_pending_xmitbuf(struct xmit_priv *pxmitpriv);
1011 struct xmit_buf	*select_and_dequeue_pending_xmitbuf(_adapter *padapter);
1012 sint	check_pending_xmitbuf(struct xmit_priv *pxmitpriv);
1013 thread_return	rtw_xmit_thread(thread_context context);
1014 #endif
1015 
1016 #ifdef CONFIG_TX_AMSDU
1017 extern void rtw_amsdu_vo_timeout_handler(void *FunctionContext);
1018 extern void rtw_amsdu_vi_timeout_handler(void *FunctionContext);
1019 extern void rtw_amsdu_be_timeout_handler(void *FunctionContext);
1020 extern void rtw_amsdu_bk_timeout_handler(void *FunctionContext);
1021 
1022 extern u8 rtw_amsdu_get_timer_status(_adapter *padapter, u8 priority);
1023 extern void rtw_amsdu_set_timer_status(_adapter *padapter, u8 priority, u8 status);
1024 extern void rtw_amsdu_set_timer(_adapter *padapter, u8 priority);
1025 extern void rtw_amsdu_cancel_timer(_adapter *padapter, u8 priority);
1026 
1027 extern s32 rtw_xmitframe_coalesce_amsdu(_adapter *padapter, struct xmit_frame *pxmitframe, struct xmit_frame *pxmitframe_queue);
1028 extern s32 check_amsdu(struct xmit_frame *pxmitframe);
1029 extern s32 check_amsdu_tx_support(_adapter *padapter);
1030 extern struct xmit_frame *rtw_get_xframe(struct xmit_priv *pxmitpriv, int *num_frame);
1031 #endif
1032 
1033 #ifdef DBG_TXBD_DESC_DUMP
1034 void rtw_tx_desc_backup(_adapter *padapter, struct xmit_frame *pxmitframe, u8 desc_size, u8 hwq);
1035 void rtw_tx_desc_backup_reset(void);
1036 u8 rtw_get_tx_desc_backup(_adapter *padapter, u8 hwq, struct rtw_tx_desc_backup **pbak);
1037 #endif
1038 
1039 #ifdef CONFIG_PCI_TX_POLLING
1040 void rtw_tx_poll_init(_adapter *padapter);
1041 void rtw_tx_poll_timeout_handler(void *FunctionContext);
1042 void rtw_tx_poll_timer_set(_adapter *padapter, u32 delay);
1043 void rtw_tx_poll_timer_cancel(_adapter *padapter);
1044 #endif
1045 
1046 u32	rtw_get_ff_hwaddr(struct xmit_frame	*pxmitframe);
1047 
1048 #ifdef CONFIG_XMIT_ACK
1049 int rtw_ack_tx_wait(struct xmit_priv *pxmitpriv, u32 timeout_ms);
1050 void rtw_ack_tx_done(struct xmit_priv *pxmitpriv, int status);
1051 #endif /* CONFIG_XMIT_ACK */
1052 
1053 enum XMIT_BLOCK_REASON {
1054 	XMIT_BLOCK_NONE = 0,
1055 	XMIT_BLOCK_REDLMEM = BIT0, /*LPS-PG*/
1056 	XMIT_BLOCK_SUSPEND = BIT1, /*WOW*/
1057 	XMIT_BLOCK_MAX = 0xFF,
1058 };
1059 void rtw_init_xmit_block(_adapter *padapter);
1060 void rtw_deinit_xmit_block(_adapter *padapter);
1061 
1062 #ifdef DBG_XMIT_BLOCK
1063 void dump_xmit_block(void *sel, _adapter *padapter);
1064 #endif
1065 void rtw_set_xmit_block(_adapter *padapter, enum XMIT_BLOCK_REASON reason);
1066 void rtw_clr_xmit_block(_adapter *padapter, enum XMIT_BLOCK_REASON reason);
1067 bool rtw_is_xmit_blocked(_adapter *padapter);
1068 
1069 /* include after declaring struct xmit_buf, in order to avoid warning */
1070 #include <xmit_osdep.h>
1071 
1072 #endif /* _RTL871X_XMIT_H_ */
1073