xref: /OK3568_Linux_fs/external/rkwifibt/drivers/rtl8852be/include/xmit_osdep.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 __XMIT_OSDEP_H_
16 #define __XMIT_OSDEP_H_
17 
18 
19 struct pkt_file {
20 	struct sk_buff *pkt;
21 	SIZE_T pkt_len;	 /* the remainder length of the open_file */
22 	_buffer *cur_buffer;
23 	u8 *buf_start;
24 	u8 *cur_addr;
25 	SIZE_T buf_len;
26 };
27 
28 #ifdef CONFIG_RTW_REDUCE_MEM
29 #define NR_XMITFRAME		512
30 #else
31 #define NR_XMITFRAME		1256
32 #endif
33 #define NR_XMITFRAME_EXT	32
34 #define SZ_XMITFRAME_EXT	1536	/*MGNT frame*/
35 
36 #ifdef CONFIG_PCI_HCI
37 	#define SZ_ALIGN_XMITFRAME_EXT	4
38 #else
39 	#ifdef USB_XMITBUF_ALIGN_SZ
40 		#define SZ_ALIGN_XMITFRAME_EXT (USB_XMITBUF_ALIGN_SZ)
41 	#else
42 		#define SZ_ALIGN_XMITFRAME_EXT 512
43 	#endif
44 #endif
45 
46 
47 struct xmit_priv;
48 struct pkt_attrib;
49 struct sta_xmit_priv;
50 struct xmit_frame;
51 struct xmit_buf;
52 
53 
54 #ifdef PLATFORM_FREEBSD
55 extern int rtw_xmit_entry(struct sk_buff *pkt, _nic_hdl pnetdev);
56 extern void rtw_xmit_entry_wrap(_nic_hdl pifp);
57 #endif /* PLATFORM_FREEBSD */
58 
59 #ifdef PLATFORM_LINUX
60 extern int _rtw_xmit_entry(struct sk_buff *pkt, _nic_hdl pnetdev);
61 
62 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 32))
63 extern netdev_tx_t rtw_xmit_entry(struct sk_buff *pkt, _nic_hdl pnetdev);
64 #else
65 extern int rtw_xmit_entry(struct sk_buff *pkt, _nic_hdl pnetdev);
66 #endif
67 
68 #ifdef RTW_PHL_TX
69 extern int rtw_os_tx(struct sk_buff *pkt, _nic_hdl pnetdev);
70 #endif
71 #endif /* PLATFORM_LINUX */
72 
73 void rtw_os_xmit_schedule(_adapter *padapter);
74 
75 #if 0 /*CONFIG_CORE_XMITBUF*/
76 int rtw_os_xmit_resource_alloc(_adapter *padapter, struct xmit_buf *pxmitbuf, u32 alloc_sz, u8 flag);
77 void rtw_os_xmit_resource_free(_adapter *padapter, struct xmit_buf *pxmitbuf, u32 free_sz, u8 flag);
78 #else
79 u8 rtw_os_xmit_resource_alloc(_adapter *padapter, struct xmit_frame *pxframe);
80 void rtw_os_xmit_resource_free(_adapter *padapter, struct xmit_frame *pxframe);
81 #endif
82 extern void rtw_set_tx_chksum_offload(struct sk_buff *pkt, struct pkt_attrib *pattrib);
83 
84 extern uint rtw_remainder_len(struct pkt_file *pfile);
85 extern void _rtw_open_pktfile(struct sk_buff *pkt, struct pkt_file *pfile);
86 extern uint _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, uint rlen);
87 extern sint rtw_endofpktfile(struct pkt_file *pfile);
88 
89 extern void rtw_os_pkt_complete(_adapter *padapter, struct sk_buff *pkt);
90 extern void rtw_os_xmit_complete(_adapter *padapter, struct xmit_frame *pxframe);
91 
92 void rtw_os_check_wakup_queue(_adapter *padapter, u16 os_qid);
93 bool rtw_os_check_stop_queue(_adapter *padapter, u16 os_qid);
94 void rtw_os_wake_queue_at_free_stainfo(_adapter *padapter, int *qcnt_freed);
95 
96 void dump_os_queue(void *sel, _adapter *padapter);
97 
98 void rtw_coalesce_tx_amsdu(_adapter *padapter, struct xmit_frame *pxframes[],
99 			   int xf_nr, bool amsdu, u32 *pktlen);
100 
101 #endif /* __XMIT_OSDEP_H_ */
102