xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/rockchip_wlan/rtl8723ds/include/rtl8710b_recv.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /******************************************************************************
3  *
4  * Copyright(c) 2007 - 2017 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 __RTL8710B_RECV_H__
17 #define __RTL8710B_RECV_H__
18 
19 #define RECV_BLK_SZ 512
20 #define RECV_BLK_CNT 16
21 #define RECV_BLK_TH RECV_BLK_CNT
22 
23 #if defined(CONFIG_USB_HCI)
24 	#ifndef MAX_RECVBUF_SZ
25 		#ifdef CONFIG_MINIMAL_MEMORY_USAGE
26 			#define MAX_RECVBUF_SZ (4000) /* about 4K */
27 		#else
28 			#ifdef CONFIG_PLATFORM_MSTAR
29 				#define MAX_RECVBUF_SZ (8192) /* 8K */
30 				#elif defined(CONFIG_PLATFORM_HISILICON)
31 				#define MAX_RECVBUF_SZ (16384) /* 16k */
32 			#else
33 				#define MAX_RECVBUF_SZ (15360) /* 15k < 16k */
34 				/* #define MAX_RECVBUF_SZ (32768) */ /* 32k */
35 				/* #define MAX_RECVBUF_SZ (20480) */ /* 20K */
36 				/* #define MAX_RECVBUF_SZ (10240)  */ /* 10K */
37 				/* #define MAX_RECVBUF_SZ (16384) */ /* 16k - 92E RX BUF :16K */
38 			#endif
39 		#endif
40 	#endif /* !MAX_RECVBUF_SZ */
41 #endif
42 
43 /* Rx smooth factor */
44 #define	Rx_Smooth_Factor (20)
45 
46 /*-----------------------------------------------------------------*/
47 /*	RTL8710B RX BUFFER DESC                                      */
48 /*-----------------------------------------------------------------*/
49 /*DWORD 0*/
50 #define SET_RX_BUFFER_DESC_DATA_LENGTH_8710B(__pRxStatusDesc, __Value)		SET_BITS_TO_LE_4BYTE(__pRxStatusDesc, 0, 14, __Value)
51 #define SET_RX_BUFFER_DESC_LS_8710B(__pRxStatusDesc, __Value)	SET_BITS_TO_LE_4BYTE(__pRxStatusDesc, 15, 1, __Value)
52 #define SET_RX_BUFFER_DESC_FS_8710B(__pRxStatusDesc, __Value)		SET_BITS_TO_LE_4BYTE(__pRxStatusDesc, 16, 1, __Value)
53 #define SET_RX_BUFFER_DESC_TOTAL_LENGTH_8710B(__pRxStatusDesc, __Value)		SET_BITS_TO_LE_4BYTE(__pRxStatusDesc, 16, 15, __Value)
54 
55 #define GET_RX_BUFFER_DESC_OWN_8710B(__pRxStatusDesc)		LE_BITS_TO_4BYTE(__pRxStatusDesc, 31, 1)
56 #define GET_RX_BUFFER_DESC_LS_8710B(__pRxStatusDesc)		LE_BITS_TO_4BYTE(__pRxStatusDesc, 15, 1)
57 #define GET_RX_BUFFER_DESC_FS_8710B(__pRxStatusDesc)		LE_BITS_TO_4BYTE(__pRxStatusDesc, 16, 1)
58 #ifdef USING_RX_TAG
59 	#define GET_RX_BUFFER_DESC_RX_TAG_8710B(__pRxStatusDesc)		LE_BITS_TO_4BYTE(__pRxStatusDesc, 16, 13)
60 #else
61 	#define GET_RX_BUFFER_DESC_TOTAL_LENGTH_8710B(__pRxStatusDesc)		LE_BITS_TO_4BYTE(__pRxStatusDesc, 16, 15)
62 #endif
63 
64 /*DWORD 1*/
65 #define SET_RX_BUFFER_PHYSICAL_LOW_8710B(__pRxStatusDesc, __Value)		SET_BITS_TO_LE_4BYTE(__pRxStatusDesc+4, 0, 32, __Value)
66 
67 /*DWORD 2*/
68 #ifdef CONFIG_64BIT_DMA
69 	#define SET_RX_BUFFER_PHYSICAL_HIGH_8710B(__pRxStatusDesc, __Value)		SET_BITS_TO_LE_4BYTE(__pRxStatusDesc+8, 0, 32, __Value)
70 #else
71 	#define SET_RX_BUFFER_PHYSICAL_HIGH_8710B(__pRxStatusDesc, __Value)
72 #endif
73 
74 #ifdef CONFIG_USB_HCI
75 	int rtl8710bu_init_recv_priv(_adapter *padapter);
76 	void rtl8710bu_free_recv_priv(_adapter *padapter);
77 	void rtl8710bu_init_recvbuf(_adapter *padapter, struct recv_buf *precvbuf);
78 #endif
79 
80 void rtl8710b_query_rx_desc_status(union recv_frame *precvframe, u8 *pdesc);
81 
82 #endif /* __RTL8710B_RECV_H__ */
83