1 /* SPDX-License-Identifier: GPL-2.0 */
2 /******************************************************************************
4 * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
6 * Modifications for inclusion into the Linux staging tree are
7 * Copyright(c) 2010 Larry Finger. All rights reserved.
13 ******************************************************************************/
14 #ifndef _RTL871X_XMIT_H_
15 #define _RTL871X_XMIT_H_
17 #include "osdep_service.h"
18 #include "drv_types.h"
19 #include "xmit_osdep.h"
21 #ifdef CONFIG_R8712_TX_AGGR
22 #define MAX_XMITBUF_SZ (16384)
24 #define MAX_XMITBUF_SZ (2048)
27 #define NR_XMITBUFF (4)
29 #ifdef CONFIG_R8712_TX_AGGR
30 #define AGGR_NR_HIGH_BOUND (4) /*(8) */
31 #define AGGR_NR_LOW_BOUND (2)
34 #define XMITBUF_ALIGN_SZ 512
35 #define TX_GUARD_BAND 5
36 #define MAX_NUMBLKS (1)
38 /* Fixed the Big Endian bug when using the software driver encryption.*/
39 #define WEP_IV(pattrib_iv, txpn, keyidx)\
41 pattrib_iv[0] = txpn._byte_.TSC0;\
42 pattrib_iv[1] = txpn._byte_.TSC1;\
43 pattrib_iv[2] = txpn._byte_.TSC2;\
44 pattrib_iv[3] = ((keyidx & 0x3) << 6);\
45 txpn.val = (txpn.val == 0xffffff) ? 0 : (txpn.val + 1);\
48 /* Fixed the Big Endian bug when doing the Tx.
49 * The Linksys WRH54G will check this.
51 #define TKIP_IV(pattrib_iv, txpn, keyidx)\
53 pattrib_iv[0] = txpn._byte_.TSC1;\
54 pattrib_iv[1] = (txpn._byte_.TSC1 | 0x20) & 0x7f;\
55 pattrib_iv[2] = txpn._byte_.TSC0;\
56 pattrib_iv[3] = BIT(5) | ((keyidx & 0x3) << 6);\
57 pattrib_iv[4] = txpn._byte_.TSC2;\
58 pattrib_iv[5] = txpn._byte_.TSC3;\
59 pattrib_iv[6] = txpn._byte_.TSC4;\
60 pattrib_iv[7] = txpn._byte_.TSC5;\
61 txpn.val = txpn.val == 0xffffffffffffULL ? 0 : \
65 #define AES_IV(pattrib_iv, txpn, keyidx)\
67 pattrib_iv[0] = txpn._byte_.TSC0;\
68 pattrib_iv[1] = txpn._byte_.TSC1;\
70 pattrib_iv[3] = BIT(5) | ((keyidx & 0x3) << 6);\
71 pattrib_iv[4] = txpn._byte_.TSC2;\
72 pattrib_iv[5] = txpn._byte_.TSC3;\
73 pattrib_iv[6] = txpn._byte_.TSC4;\
74 pattrib_iv[7] = txpn._byte_.TSC5;\
75 txpn.val = txpn.val == 0xffffffffffffULL ? 0 : \
81 struct list_head pending;
82 struct __queue *sta_queue;
83 struct hw_txqueue *phwtxqueue;
96 u16 pktlen; /* the original 802.3 pkt raw_data len
97 * (not include ether_hdr data)
101 u8 pkt_hdrlen; /*the original 802.3 pkt header len*/
102 u8 hdrlen; /*the WLAN Header Len*/
106 u8 vcs_mode; /*virtual carrier sense method*/
107 u8 pctrl;/*per packet txdesc control enable*/
111 u8 encrypt; /* when 0 indicate no encrypt. when non-zero,
112 * indicate the encrypt algorithm
117 unsigned char icv[8];
118 u8 dst[ETH_ALEN] __aligned(2); /* for ether_addr_copy */
122 struct sta_info *psta;
125 #define WLANHDR_OFFSET 64
126 #define DATA_FRAMETAG 0x01
127 #define L2_FRAMETAG 0x02
128 #define MGNT_FRAMETAG 0x03
129 #define AMSDU_FRAMETAG 0x04
130 #define EII_FRAMETAG 0x05
131 #define IEEE8023_FRAMETAG 0x06
132 #define MP_FRAMETAG 0x07
133 #define TXAGG_FRAMETAG 0x08
136 struct list_head list;
141 struct urb *pxmit_urb[8];
146 struct list_head list;
147 struct pkt_attrib attrib;
150 struct _adapter *padapter;
152 struct xmit_buf *pxmitbuf;
155 struct urb *pxmit_urb[8];
161 struct list_head tx_pending;
162 struct __queue sta_pending;
166 struct sta_xmit_priv {
169 sint apsd_setting; /* When bit mask is on, the associated edca
170 * queue supports APSD.
172 struct tx_servq be_q; /* priority == 0,3 */
173 struct tx_servq bk_q; /* priority == 1,2*/
174 struct tx_servq vi_q; /*priority == 4,5*/
175 struct tx_servq vo_q; /*priority == 6,7*/
176 struct list_head legacy_dz;
177 struct list_head apsd;
187 sint free_sz; /* in units of 64 bytes */
197 struct __queue be_pending;
198 struct __queue bk_pending;
199 struct __queue vi_pending;
200 struct __queue vo_pending;
201 struct __queue bm_pending;
202 struct __queue legacy_dz_queue;
203 struct __queue apsd_queue;
204 u8 *pallocated_frame_buf;
206 uint free_xmitframe_cnt;
209 struct __queue free_xmit_queue;
210 struct hw_txqueue be_txqueue;
211 struct hw_txqueue bk_txqueue;
212 struct hw_txqueue vi_txqueue;
213 struct hw_txqueue vo_txqueue;
214 struct hw_txqueue bmc_txqueue;
216 struct _adapter *adapter;
224 struct hw_xmit *hwxmits;
227 struct tasklet_struct xmit_tasklet;
228 struct work_struct xmit_pipe4_reset_wi;
229 struct work_struct xmit_pipe6_reset_wi;
230 struct work_struct xmit_piped_reset_wi;
231 /*per AC pending irp*/
236 struct __queue free_amsdu_xmit_queue;
237 u8 *pallocated_amsdu_frame_buf;
238 u8 *pxmit_amsdu_frame_buf;
239 uint free_amsdu_xmitframe_cnt;
240 struct __queue free_txagg_xmit_queue;
241 u8 *pallocated_txagg_frame_buf;
242 u8 *pxmit_txagg_frame_buf;
243 uint free_txagg_xmitframe_cnt;
245 struct __queue free_xmitbuf_queue;
246 struct __queue pending_xmitbuf_queue;
247 u8 *pallocated_xmitbuf;
249 uint free_xmitbuf_cnt;
252 void r8712_free_xmitbuf(struct xmit_priv *pxmitpriv,
253 struct xmit_buf *pxmitbuf);
254 struct xmit_buf *r8712_alloc_xmitbuf(struct xmit_priv *pxmitpriv);
255 void r8712_update_protection(struct _adapter *padapter, u8 *ie, uint ie_len);
256 struct xmit_frame *r8712_alloc_xmitframe(struct xmit_priv *pxmitpriv);
257 void r8712_free_xmitframe(struct xmit_priv *pxmitpriv,
258 struct xmit_frame *pxmitframe);
259 void r8712_free_xmitframe_queue(struct xmit_priv *pxmitpriv,
260 struct __queue *pframequeue);
261 int r8712_xmit_classifier(struct _adapter *padapter,
262 struct xmit_frame *pxmitframe);
263 sint r8712_xmitframe_coalesce(struct _adapter *padapter, _pkt *pkt,
264 struct xmit_frame *pxmitframe);
265 sint _r8712_init_hw_txqueue(struct hw_txqueue *phw_txqueue, u8 ac_tag);
266 void _r8712_init_sta_xmit_priv(struct sta_xmit_priv *psta_xmitpriv);
267 int r8712_update_attrib(struct _adapter *padapter, _pkt *pkt,
268 struct pkt_attrib *pattrib);
269 int r8712_txframes_sta_ac_pending(struct _adapter *padapter,
270 struct pkt_attrib *pattrib);
271 int _r8712_init_xmit_priv(struct xmit_priv *pxmitpriv,
272 struct _adapter *padapter);
273 void _free_xmit_priv(struct xmit_priv *pxmitpriv);
274 void r8712_free_xmitframe_ex(struct xmit_priv *pxmitpriv,
275 struct xmit_frame *pxmitframe);
276 int r8712_pre_xmit(struct _adapter *padapter, struct xmit_frame *pxmitframe);
277 int r8712_xmit_enqueue(struct _adapter *padapter,
278 struct xmit_frame *pxmitframe);
279 void r8712_xmit_direct(struct _adapter *padapter, struct xmit_frame *pxmitframe);
280 void r8712_xmit_bh(struct tasklet_struct *t);
282 void xmitframe_xmitbuf_attach(struct xmit_frame *pxmitframe,
283 struct xmit_buf *pxmitbuf);
285 #include "rtl8712_xmit.h"
287 #endif /*_RTL871X_XMIT_H_*/