xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/rockchip_wlan/rtl8189es/include/rtl8814a_recv.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
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  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
17  *
18  *
19  ******************************************************************************/
20 #ifndef __RTL8814A_RECV_H__
21 #define __RTL8814A_RECV_H__
22 
23 #if defined(CONFIG_USB_HCI)
24 
25 #ifndef MAX_RECVBUF_SZ
26 #ifdef PLATFORM_OS_CE
27 #define MAX_RECVBUF_SZ (8192+1024) // 8K+1k
28 #else
29 	#ifndef CONFIG_MINIMAL_MEMORY_USAGE
30 		#ifdef CONFIG_PLATFORM_MSTAR
31 			#define MAX_RECVBUF_SZ (8192) // 8K
32 		#else
33 		#define MAX_RECVBUF_SZ (32768) // 32k
34 		#endif
35 		//#define MAX_RECVBUF_SZ (24576) // 24k
36 		//#define MAX_RECVBUF_SZ (20480) //20K
37 		//#define MAX_RECVBUF_SZ (10240) //10K
38 		//#define MAX_RECVBUF_SZ (15360) // 15k < 16k
39 		//#define MAX_RECVBUF_SZ (8192+1024) // 8K+1k
40 	#else
41 		#define MAX_RECVBUF_SZ (4000) // about 4K
42 	#endif
43 #endif
44 #endif //!MAX_RECVBUF_SZ
45 
46 #elif defined(CONFIG_PCI_HCI)
47 //#ifndef CONFIG_MINIMAL_MEMORY_USAGE
48 //	#define MAX_RECVBUF_SZ (9100)
49 //#else
50 	#define MAX_RECVBUF_SZ (4000) // about 4K
51 //#endif
52 
53 
54 #elif defined(CONFIG_SDIO_HCI)
55 /* temp solution
56 #ifdef CONFIG_SDIO_RX_COPY
57 #define MAX_RECVBUF_SZ (10240)
58 #else // !CONFIG_SDIO_RX_COPY
59 #define MAX_RECVBUF_SZ	MAX_RX_DMA_BUFFER_SIZE_8821
60 #endif // !CONFIG_SDIO_RX_COPY
61 */
62 #endif
63 
64 
65 /* RX buffer descriptor */
66 /* DWORD 0 */
67 #define SET_RX_BUFFER_DESC_DATA_LENGTH_8814A(__pRxStatusDesc, __Value)		SET_BITS_TO_LE_4BYTE(__pRxStatusDesc, 0, 14, __Value)
68 #define SET_RX_BUFFER_DESC_LS_8814A(__pRxStatusDesc, __Value)					SET_BITS_TO_LE_4BYTE(__pRxStatusDesc, 14, 1, __Value)
69 #define SET_RX_BUFFER_DESC_FS_8814A(__pRxStatusDesc, __Value)					SET_BITS_TO_LE_4BYTE(__pRxStatusDesc, 15, 1, __Value)
70 #define SET_RX_BUFFER_DESC_TOTAL_LENGTH_8814A(__pRxStatusDesc, __Value)		SET_BITS_TO_LE_4BYTE(__pRxStatusDesc, 16, 16, __Value)
71 
72 #define GET_RX_BUFFER_DESC_OWN_8814A(__pRxStatusDesc)						LE_BITS_TO_4BYTE(__pRxStatusDesc, 31, 1)
73 #define GET_RX_BUFFER_DESC_LS_8814A(__pRxStatusDesc)							LE_BITS_TO_4BYTE(__pRxStatusDesc, 14, 1)
74 #define GET_RX_BUFFER_DESC_FS_8814A(__pRxStatusDesc)							LE_BITS_TO_4BYTE(__pRxStatusDesc, 15, 1)
75 #define GET_RX_BUFFER_DESC_TOTAL_LENGTH_8814A(__pRxStatusDesc)				LE_BITS_TO_4BYTE(__pRxStatusDesc, 16, 15)
76 
77 /* DWORD 1 */
78 #define SET_RX_BUFFER_PHYSICAL_LOW_8814A(__pRxStatusDesc, __Value)			SET_BITS_TO_LE_4BYTE(__pRxStatusDesc+4, 0, 32, __Value)
79 #define GET_RX_BUFFER_PHYSICAL_LOW_8814A(__pRxStatusDesc)					LE_BITS_TO_4BYTE(__pRxStatusDesc+4, 0, 32)
80 
81 /* DWORD 2 */
82 #define SET_RX_BUFFER_PHYSICAL_HIGH_8814A(__pRxStatusDesc, __Value)			SET_BITS_TO_LE_4BYTE(__pRxStatusDesc+8, 0, 32, __Value)
83 
84 /* DWORD 3*/ /* RESERVED */
85 
86 
87 /*=============
88 //RX Info
89 ==============*/
90 //DWORD 0
91 #define SET_RX_STATUS_DESC_PKT_LEN_8814A(__pRxStatusDesc, __Value)		SET_BITS_TO_LE_4BYTE( __pRxStatusDesc, 0, 14, __Value)
92 #define SET_RX_STATUS_DESC_EOR_8814A(__pRxStatusDesc, __Value)			SET_BITS_TO_LE_4BYTE( __pRxStatusDesc, 30, 1, __Value)
93 #define SET_RX_STATUS_DESC_OWN_8814AE(__pRxStatusDesc, __Value)		SET_BITS_TO_LE_4BYTE( __pRxStatusDesc, 31, 1, __Value)
94 
95 #define GET_RX_STATUS_DESC_PKT_LEN_8814A(__pRxStatusDesc)				LE_BITS_TO_4BYTE( __pRxStatusDesc, 0, 14)
96 #define GET_RX_STATUS_DESC_CRC32_8814A(__pRxStatusDesc)					LE_BITS_TO_4BYTE( __pRxStatusDesc, 14, 1)
97 #define GET_RX_STATUS_DESC_ICV_8814A(__pRxStatusDesc)					LE_BITS_TO_4BYTE( __pRxStatusDesc, 15, 1)
98 #define GET_RX_STATUS_DESC_DRVINFO_SIZE_8814A(__pRxStatusDesc)			LE_BITS_TO_4BYTE( __pRxStatusDesc, 16, 4)
99 #define GET_RX_STATUS_DESC_SECURITY_8814A(__pRxStatusDesc)				LE_BITS_TO_4BYTE( __pRxStatusDesc, 20, 3)
100 #define GET_RX_STATUS_DESC_QOS_8814A(__pRxStatusDesc)					LE_BITS_TO_4BYTE( __pRxStatusDesc, 23, 1)
101 #define GET_RX_STATUS_DESC_SHIFT_8814A(__pRxStatusDesc)						LE_BITS_TO_4BYTE( __pRxStatusDesc, 24, 2)
102 #define GET_RX_STATUS_DESC_PHY_STATUS_8814A(__pRxStatusDesc)				LE_BITS_TO_4BYTE( __pRxStatusDesc, 26, 1)
103 #define GET_RX_STATUS_DESC_SWDEC_8814A(__pRxStatusDesc)						LE_BITS_TO_4BYTE( __pRxStatusDesc, 27, 1)
104 #define GET_RX_STATUS_DESC_LAST_SEG_8814AE(__pRxStatusDesc)			LE_BITS_TO_4BYTE( __pRxStatusDesc, 28, 1)
105 #define GET_RX_STATUS_DESC_EOR_8814A(__pRxStatusDesc)						LE_BITS_TO_4BYTE( __pRxStatusDesc, 30, 1)
106 
107 //DWORD 1
108 #define GET_RX_STATUS_DESC_MACID_8814A(__pRxStatusDesc)					LE_BITS_TO_4BYTE(__pRxStatusDesc+4, 0, 7)
109 #define GET_RX_STATUS_DESC_EXT_SECTYPE_8814A(__pRxStatusDesc)				LE_BITS_TO_4BYTE(__pRxStatusDesc+4, 7, 1)/* 20130415 KaiYuan add for 8814 */
110 #define GET_RX_STATUS_DESC_TID_8814A(__pRxStatusDesc)					LE_BITS_TO_4BYTE(__pRxStatusDesc+4, 8, 4)
111 #define GET_RX_STATUS_DESC_MACID_VLD_8814A(__pRxStatusDesc)				LE_BITS_TO_4BYTE(__pRxStatusDesc+4, 12, 1)
112 #define GET_RX_STATUS_DESC_AMSDU_8814A(__pRxStatusDesc)					LE_BITS_TO_4BYTE(__pRxStatusDesc+4, 13, 1)
113 #define GET_RX_STATUS_DESC_RXID_MATCH_8814A(__pRxStatusDesc)				LE_BITS_TO_4BYTE(__pRxStatusDesc+4, 14, 1)
114 #define GET_RX_STATUS_DESC_PAGGR_8814A(__pRxStatusDesc)						LE_BITS_TO_4BYTE( __pRxStatusDesc+4, 15, 1)
115 #define GET_RX_STATUS_DESC_TCPOFFLOAD_CHKERR_8814A(__pRxStatusDesc)		LE_BITS_TO_4BYTE( __pRxStatusDesc+4, 20, 1)
116 #define GET_RX_STATUS_DESC_TCPOFFLOAD_IPVER_8814A(__pRxStatusDesc)			LE_BITS_TO_4BYTE( __pRxStatusDesc+4, 21, 1)
117 #define GET_RX_STATUS_DESC_TCPOFFLOAD_IS_TCPUDP_8814A(__pRxStatusDesc)		LE_BITS_TO_4BYTE( __pRxStatusDesc+4, 22, 1)
118 #define GET_RX_STATUS_DESC_TCPOFFLOAD_CHK_VLD_8814A(__pRxStatusDesc)		LE_BITS_TO_4BYTE( __pRxStatusDesc+4, 23, 1)
119 #define GET_RX_STATUS_DESC_PAM_8814A(__pRxStatusDesc)						LE_BITS_TO_4BYTE( __pRxStatusDesc+4, 24, 1)
120 #define GET_RX_STATUS_DESC_PWR_8814A(__pRxStatusDesc)						LE_BITS_TO_4BYTE( __pRxStatusDesc+4, 25, 1)
121 #define GET_RX_STATUS_DESC_MORE_DATA_8814A(__pRxStatusDesc)					LE_BITS_TO_4BYTE( __pRxStatusDesc+4, 26, 1)
122 #define GET_RX_STATUS_DESC_MORE_FRAG_8814A(__pRxStatusDesc)					LE_BITS_TO_4BYTE( __pRxStatusDesc+4, 27, 1)
123 #define GET_RX_STATUS_DESC_TYPE_8814A(__pRxStatusDesc)						LE_BITS_TO_4BYTE( __pRxStatusDesc+4, 28, 2)
124 #define GET_RX_STATUS_DESC_FIRST_SEG_8814AE(__pRxStatusDesc)			LE_BITS_TO_4BYTE( __pRxStatusDesc, 29, 1)
125 #define GET_RX_STATUS_DESC_EOR_8814AE(__pRxStatusDesc)				LE_BITS_TO_4BYTE( __pRxStatusDesc, 30, 1)
126 #define GET_RX_STATUS_DESC_MC_8814A(__pRxStatusDesc)							LE_BITS_TO_4BYTE( __pRxStatusDesc+4, 30, 1)
127 #define GET_RX_STATUS_DESC_BC_8814A(__pRxStatusDesc)							LE_BITS_TO_4BYTE( __pRxStatusDesc+4, 31, 1)
128 
129 //DWORD 2
130 #define GET_RX_STATUS_DESC_SEQ_8814A(__pRxStatusDesc)						LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 0, 12)
131 #define GET_RX_STATUS_DESC_FRAG_8814A(__pRxStatusDesc)						LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 12, 4)
132 #ifdef CONFIG_USB_RX_AGGREGATION
133 #define GET_RX_STATUS_DESC_USB_AGG_PKTNUM_8814A(__pRxStatusDesc)			LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 16, 8)
134 #else
135 #define GET_RX_STATUS_DESC_RX_IS_QOS_8814A(__pRxStatusDesc)					LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 16, 1)
136 #endif
137 #define GET_RX_STATUS_DESC_WLANHD_IV_LEN_8814A(__pRxStatusDesc)			LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 18, 6)
138 #define GET_RX_STATUS_DESC_HWRSVD_8814A(__pRxStatusDesc)					LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 24, 4)
139 #define GET_RX_STATUS_C2H_8814A(__pRxStatusDesc)								LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 28, 1)
140 #define GET_RX_STATUS_DESC_FCS_OK_8814A(__pRxStatusDesc)					LE_BITS_TO_4BYTE( __pRxStatusDesc+8, 31, 1)
141 
142 //DWORD 3
143 #define GET_RX_STATUS_DESC_RX_RATE_8814A(__pRxStatusDesc)					LE_BITS_TO_4BYTE( __pRxStatusDesc+12, 0, 7)
144 #define GET_RX_STATUS_DESC_BSSID_FIT_H_8814A(__pRxStatusDesc)				LE_BITS_TO_4BYTE( __pRxStatusDesc+12, 7, 3)//20130415 KaiYuan add for 8814
145 #define GET_RX_STATUS_DESC_HTC_8814A(__pRxStatusDesc)						LE_BITS_TO_4BYTE( __pRxStatusDesc+12, 10, 1)
146 #define GET_RX_STATUS_DESC_EOSP_8814A(__pRxStatusDesc)						LE_BITS_TO_4BYTE( __pRxStatusDesc+12, 11, 1)
147 #define GET_RX_STATUS_DESC_BSSID_FIT_L_8814A(__pRxStatusDesc)				LE_BITS_TO_4BYTE( __pRxStatusDesc+12, 12, 2)
148 #define GET_RX_STATUS_DESC_DMA_AGG_NUM_8814A(__pRxStatusDesc)				LE_BITS_TO_4BYTE( __pRxStatusDesc+12, 16, 8)//20130415 KaiYuan Check if it exist anymore
149 #define GET_RX_STATUS_DESC_PATTERN_MATCH_8814A(__pRxStatusDesc)			LE_BITS_TO_4BYTE(__pRxStatusDesc+12, 29, 1)
150 #define GET_RX_STATUS_DESC_UNICAST_8814A(__pRxStatusDesc)					LE_BITS_TO_4BYTE(__pRxStatusDesc+12, 30, 1)
151 #define GET_RX_STATUS_DESC_MAGIC_WAKE_8814A(__pRxStatusDesc)				LE_BITS_TO_4BYTE(__pRxStatusDesc+12, 31, 1)
152 
153 //DWORD 4
154 #define GET_RX_STATUS_DESC_PATTERN_IDX_8814A(__pRxStatusDesc)	 			LE_BITS_TO_4BYTE( __pRxStatusDesc+16, 0, 8)
155 #define GET_RX_STATUS_DESC_RX_EOF_8814A(__pRxStatusDesc)	 				LE_BITS_TO_4BYTE( __pRxStatusDesc+16, 8, 1)
156 #define GET_RX_STATUS_DESC_RX_SCRAMBLER_8814A(__pRxStatusDesc)				LE_BITS_TO_4BYTE( __pRxStatusDesc+16, 9, 7)
157 #define GET_RX_STATUS_DESC_RX_PRE_NDP_VLD_8814A(__pRxStatusDesc)	 		LE_BITS_TO_4BYTE( __pRxStatusDesc+16, 16, 1)
158 #define GET_RX_STATUS_DESC_A1_FIT_8814A(__pRxStatusDesc)	 					LE_BITS_TO_4BYTE( __pRxStatusDesc+16, 24, 5)
159 
160 
161 //DWORD 5
162 #define GET_RX_STATUS_DESC_TSFL_8814A(__pRxStatusDesc)						LE_BITS_TO_4BYTE( __pRxStatusDesc+20, 0, 32)
163 
164 
165 // Rx smooth factor
166 #define Rx_Smooth_Factor (20)
167 
168 #ifdef CONFIG_USB_HCI
169 s32 rtl8814au_init_recv_priv(PADAPTER padapter);
170 void rtl8814au_free_recv_priv(PADAPTER padapter);
171 #endif
172 
173 #ifdef CONFIG_PCI_HCI
174 s32 rtl8814ae_init_recv_priv(PADAPTER padapter);
175 void rtl8814ae_free_recv_priv(PADAPTER padapter);
176 #endif
177 
178 /* temp solution
179 #ifdef CONFIG_SDIO_HCI
180 s32 InitRecvPriv8821AS(PADAPTER padapter);
181 void FreeRecvPriv8821AS(PADAPTER padapter);
182 #endif // CONFIG_SDIO_HCI
183 */
184 
185 void rtl8814_query_rx_desc_status(union recv_frame *precvframe, u8 *pdesc);
186 
187 #endif /* __RTL8814A_RECV_H__ */
188 
189