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