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