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