xref: /OK3568_Linux_fs/external/rkwifibt/drivers/rtl8852be/include/rtw_xmit_shortcut.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 _RTW_XMIT_SHORTCUT_H_
16 #define _RTW_XMIT_SHORTCUT_H_
17 
18 #ifdef CONFIG_CORE_TXSC
19 
20 #ifndef USE_ONE_WLHDR
21 #define USE_PREV_WLHDR_BUF
22 #endif
23 
24 #define CORE_TXSC_ENTRY_NUM 8
25 #define CORE_TXSC_WLHDR_SIZE (WLHDR_SIZE + SNAP_SIZE + 2 + _AES_IV_LEN_)
26 #define CORE_TXSC_DEBUG_BUF_SIZE (sizeof(struct rtw_xmit_req) + sizeof(struct rtw_pkt_buf_list)*2)
27 
28 enum txsc_action_type {
29 	TXSC_NONE,
30 	TXSC_SKIP,
31 	TXSC_ADD,
32 	TXSC_APPLY,
33 	TXSC_AMSDU_APPLY,
34 	TXSC_DEBUG,
35 };
36 
37 enum full_cnt_type {
38 	PHL_WD_EMPTY,
39 	PHL_BD_FULL,
40 	PHL_WD_RECYCLE_NOTHING,
41 	PHL_WD_RECYCLE_OK,
42 };
43 
44 struct txsc_pkt_entry {
45 	enum txsc_action_type step;
46 	struct sta_info *psta;
47 	struct rtw_xmit_req *ptxreq;
48 
49 	u8 txsc_id;
50 	u8 priority;
51 
52 	struct sk_buff *xmit_skb[MAX_TXSC_SKB_NUM];
53 	u8 skb_cnt;
54 };
55 
56 struct txsc_entry {
57 	u8	txsc_is_used;
58 	u8	txsc_ethdr[ETH_HLEN];
59 
60 	/* wlhdr --- */
61 	#ifdef USE_ONE_WLHDR
62 	u8	*txsc_wlhdr;
63 	#else
64 	u8	txsc_wlhdr[CORE_TXSC_WLHDR_SIZE];
65 	#endif
66 	u8	txsc_wlhdr_len;
67 	struct rtw_pkt_buf_list	txsc_pkt_list0;
68 	/* wlhdr --- */
69 
70 	struct rtw_t_meta_data	txsc_mdata;
71 	u32	txsc_frag_len;/* for pkt frag check */
72 
73 	u8	txsc_phl_id; /* CONFIG_PHL_TXSC */
74 	u32	txsc_cache_hit;
75 };
76 
77 void _print_txreq_mdata(struct rtw_t_meta_data *mdata, const char *func);
78 void _print_txreq_pklist(struct xmit_frame *pxframe, struct rtw_xmit_req *ptxsc_txreq, struct sk_buff *pskb, const char *func);
79 void txsc_init(_adapter *padapter);
80 void txsc_clear(_adapter *padapter);
81 void txsc_dump(_adapter *padapter);
82 void txsc_dump_data(u8 *buf, u16 buf_len, const char *prefix);
83 u8 txsc_get_sc_cached_entry(_adapter *padapter, struct sk_buff *pskb, struct txsc_pkt_entry *txsc_pkt);
84 void txsc_add_sc_cache_entry(_adapter *padapter, struct xmit_frame *pxframe, struct txsc_pkt_entry *txsc_pkt);
85 u8 txsc_apply_sc_cached_entry(_adapter *padapter, struct txsc_pkt_entry *txsc_pkt);
86 #ifdef CONFIG_PCI_HCI
87 void txsc_fill_txreq_phyaddr(_adapter *padapter, struct rtw_pkt_buf_list *pkt_list);
88 void txsc_recycle_txreq_phyaddr(_adapter *padapter, struct rtw_xmit_req *txreq);
89 #endif
90 void txsc_free_txreq(_adapter *padapter, struct rtw_xmit_req *txreq);
91 void txsc_debug_sc_entry(_adapter *padapter, struct xmit_frame *pxframe, struct txsc_pkt_entry *txsc_pkt);
92 void txsc_issue_addbareq_cmd(_adapter *padapter, u8 priority, struct sta_info *psta, u8 issue_when_busy);
93 #endif /* CONFIG_CORE_TXSC */
94 #endif /* _RTW_XMIT_SHORTCUT_H_ */
95 
96