xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/rockchip_wlan/rtl8821cs/include/rtl8723d_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 __RTL8723D_RECV_H__
17 #define __RTL8723D_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 
25 	#ifndef MAX_RECVBUF_SZ
26 		#ifndef CONFIG_MINIMAL_MEMORY_USAGE
27 			/* #define MAX_RECVBUF_SZ (32768) */ /* 32k */
28 			/* #define MAX_RECVBUF_SZ (16384) */ /* 16K */
29 			/* #define MAX_RECVBUF_SZ (10240) */ /* 10K */
30 			#ifdef CONFIG_PLATFORM_MSTAR
31 				#define MAX_RECVBUF_SZ (8192) /* 8K */
32 			#else
33 				#define MAX_RECVBUF_SZ (15360) /* 15k < 16k */
34 			#endif
35 			/* #define MAX_RECVBUF_SZ (8192+1024) */ /* 8K+1k */
36 		#else
37 			#define MAX_RECVBUF_SZ (4000) /* about 4K */
38 		#endif
39 	#endif /* !MAX_RECVBUF_SZ */
40 
41 #elif defined(CONFIG_PCI_HCI)
42 	/* #ifndef CONFIG_MINIMAL_MEMORY_USAGE */
43 	/*	#define MAX_RECVBUF_SZ (9100) */
44 	/* #else */
45 	#define MAX_RECVBUF_SZ (4000) /* about 4K
46 	* #endif */
47 
48 
49 #elif defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
50 
51 	#define MAX_RECVBUF_SZ (RX_DMA_BOUNDARY_8723D + 1)
52 
53 #endif
54 
55 /* Rx smooth factor */
56 #define	Rx_Smooth_Factor (20)
57 
58 #ifdef CONFIG_SDIO_HCI
59 	#ifndef CONFIG_SDIO_RX_COPY
60 		#undef MAX_RECVBUF_SZ
61 		#define MAX_RECVBUF_SZ	(RX_DMA_SIZE_8723D - RX_DMA_RESERVED_SIZE_8723D)
62 	#endif /* !CONFIG_SDIO_RX_COPY */
63 #endif /* CONFIG_SDIO_HCI */
64 
65 /*-----------------------------------------------------------------*/
66 /*	RTL8723D RX BUFFER DESC                                      */
67 /*-----------------------------------------------------------------*/
68 /*DWORD 0*/
69 #define SET_RX_BUFFER_DESC_DATA_LENGTH_8723D(__pRxStatusDesc, __Value)		SET_BITS_TO_LE_4BYTE(__pRxStatusDesc, 0, 14, __Value)
70 #define SET_RX_BUFFER_DESC_LS_8723D(__pRxStatusDesc, __Value)	SET_BITS_TO_LE_4BYTE(__pRxStatusDesc, 15, 1, __Value)
71 #define SET_RX_BUFFER_DESC_FS_8723D(__pRxStatusDesc, __Value)		SET_BITS_TO_LE_4BYTE(__pRxStatusDesc, 16, 1, __Value)
72 #define SET_RX_BUFFER_DESC_TOTAL_LENGTH_8723D(__pRxStatusDesc, __Value)		SET_BITS_TO_LE_4BYTE(__pRxStatusDesc, 16, 15, __Value)
73 
74 #define GET_RX_BUFFER_DESC_OWN_8723D(__pRxStatusDesc)		LE_BITS_TO_4BYTE(__pRxStatusDesc, 31, 1)
75 #define GET_RX_BUFFER_DESC_LS_8723D(__pRxStatusDesc)		LE_BITS_TO_4BYTE(__pRxStatusDesc, 15, 1)
76 #define GET_RX_BUFFER_DESC_FS_8723D(__pRxStatusDesc)		LE_BITS_TO_4BYTE(__pRxStatusDesc, 16, 1)
77 #ifdef USING_RX_TAG
78 	#define GET_RX_BUFFER_DESC_RX_TAG_8723D(__pRxStatusDesc)		LE_BITS_TO_4BYTE(__pRxStatusDesc, 16, 13)
79 #else
80 	#define GET_RX_BUFFER_DESC_TOTAL_LENGTH_8723D(__pRxStatusDesc)		LE_BITS_TO_4BYTE(__pRxStatusDesc, 16, 15)
81 #endif
82 
83 /*DWORD 1*/
84 #define SET_RX_BUFFER_PHYSICAL_LOW_8723D(__pRxStatusDesc, __Value)		SET_BITS_TO_LE_4BYTE(__pRxStatusDesc+4, 0, 32, __Value)
85 
86 /*DWORD 2*/
87 #ifdef CONFIG_64BIT_DMA
88 	#define SET_RX_BUFFER_PHYSICAL_HIGH_8723D(__pRxStatusDesc, __Value)		SET_BITS_TO_LE_4BYTE(__pRxStatusDesc+8, 0, 32, __Value)
89 #else
90 	#define SET_RX_BUFFER_PHYSICAL_HIGH_8723D(__pRxStatusDesc, __Value)
91 #endif
92 
93 
94 #if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
95 	s32 rtl8723ds_init_recv_priv(PADAPTER padapter);
96 	void rtl8723ds_free_recv_priv(PADAPTER padapter);
97 	s32 rtl8723ds_recv_hdl(_adapter *padapter);
98 #endif
99 
100 #ifdef CONFIG_USB_HCI
101 	int rtl8723du_init_recv_priv(_adapter *padapter);
102 	void rtl8723du_free_recv_priv(_adapter *padapter);
103 	void rtl8723du_init_recvbuf(_adapter *padapter, struct recv_buf *precvbuf);
104 #endif
105 
106 #ifdef CONFIG_PCI_HCI
107 	s32 rtl8723de_init_recv_priv(PADAPTER padapter);
108 	void rtl8723de_free_recv_priv(PADAPTER padapter);
109 #endif
110 
111 void rtl8723d_query_rx_desc_status(union recv_frame *precvframe, u8 *pdesc);
112 
113 #endif /* __RTL8723D_RECV_H__ */
114