1
2
3
4
5
6
7
8
9
10
11
12
13
14 #ifndef _RTL871X_XMIT_H_
15 #define _RTL871X_XMIT_H_
16
17 #include "osdep_service.h"
18 #include "drv_types.h"
19 #include "xmit_osdep.h"
20
21 #ifdef CONFIG_R8712_TX_AGGR
22 #define MAX_XMITBUF_SZ (16384)
23 #else
24 #define MAX_XMITBUF_SZ (2048)
25 #endif
26
27 #define NR_XMITBUFF (4)
28
29 #ifdef CONFIG_R8712_TX_AGGR
30 #define AGGR_NR_HIGH_BOUND (4)
31 #define AGGR_NR_LOW_BOUND (2)
32 #endif
33
34 #define XMITBUF_ALIGN_SZ 512
35 #define TX_GUARD_BAND 5
36 #define MAX_NUMBLKS (1)
37
38
39 #define WEP_IV(pattrib_iv, txpn, keyidx)\
40 do { \
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);\
46 } while (0)
47
48
49
50
51 #define TKIP_IV(pattrib_iv, txpn, keyidx)\
52 do { \
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 : \
62 (txpn.val+1);\
63 } while (0)
64
65 #define AES_IV(pattrib_iv, txpn, keyidx)\
66 do { \
67 pattrib_iv[0] = txpn._byte_.TSC0;\
68 pattrib_iv[1] = txpn._byte_.TSC1;\
69 pattrib_iv[2] = 0;\
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 : \
76 (txpn.val+1);\
77 } while (0)
78
79 struct hw_xmit {
80 spinlock_t xmit_lock;
81 struct list_head pending;
82 struct __queue *sta_queue;
83 struct hw_txqueue *phwtxqueue;
84 sint txcmdcnt;
85 int accnt;
86 };
87
88 struct pkt_attrib {
89 u8 type;
90 u8 subtype;
91 u8 bswenc;
92 u8 dhcp_pkt;
93
94 u16 seqnum;
95 u16 ether_type;
96 u16 pktlen;
97
98
99 u16 last_txcmdsz;
100
101 u8 pkt_hdrlen;
102 u8 hdrlen;
103 u8 nr_frags;
104 u8 ack_policy;
105 u8 mac_id;
106 u8 vcs_mode;
107 u8 pctrl;
108 u8 qsel;
109
110 u8 priority;
111 u8 encrypt;
112
113
114 u8 iv_len;
115 u8 icv_len;
116 unsigned char iv[8];
117 unsigned char icv[8];
118 u8 dst[ETH_ALEN];
119 u8 src[ETH_ALEN];
120 u8 ta[ETH_ALEN];
121 u8 ra[ETH_ALEN];
122 struct sta_info *psta;
123 };
124
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
134
135 struct xmit_buf {
136 struct list_head list;
137
138 u8 *pallocated_buf;
139 u8 *pbuf;
140 void *priv_data;
141 struct urb *pxmit_urb[8];
142 u32 aggr_nr;
143 };
144
145 struct xmit_frame {
146 struct list_head list;
147 struct pkt_attrib attrib;
148 _pkt *pkt;
149 int frame_tag;
150 struct _adapter *padapter;
151 u8 *buf_addr;
152 struct xmit_buf *pxmitbuf;
153 u8 *mem_addr;
154 u16 sz[8];
155 struct urb *pxmit_urb[8];
156 u8 bpending[8];
157 u8 last[8];
158 };
159
160 struct tx_servq {
161 struct list_head tx_pending;
162 struct __queue sta_pending;
163 int qcnt;
164 };
165
166 struct sta_xmit_priv {
167 spinlock_t lock;
168 sint option;
169 sint apsd_setting;
170
171
172 struct tx_servq be_q;
173 struct tx_servq bk_q;
174 struct tx_servq vi_q;
175 struct tx_servq vo_q;
176 struct list_head legacy_dz;
177 struct list_head apsd;
178 u16 txseq_tid[16];
179 uint sta_tx_bytes;
180 u64 sta_tx_pkts;
181 uint sta_tx_fail;
182 };
183
184 struct hw_txqueue {
185 sint head;
186 sint tail;
187 sint free_sz;
188 sint free_cmdsz;
189 sint txsz[8];
190 uint ff_hwaddr;
191 uint cmd_hwaddr;
192 sint ac_tag;
193 };
194
195 struct xmit_priv {
196 spinlock_t lock;
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;
205 u8 *pxmit_frame_buf;
206 uint free_xmitframe_cnt;
207 uint mapping_addr;
208 uint pkt_sz;
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;
215 uint frag_len;
216 struct _adapter *adapter;
217 u8 vcs_setting;
218 u8 vcs;
219 u8 vcs_type;
220 u16 rts_thresh;
221 uint tx_bytes;
222 u64 tx_pkts;
223 uint tx_drop;
224 struct hw_xmit *hwxmits;
225 u8 hwxmit_entry;
226 u8 txirp_cnt;
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
232 int beq_cnt;
233 int bkq_cnt;
234 int viq_cnt;
235 int voq_cnt;
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;
244 int cmdseq;
245 struct __queue free_xmitbuf_queue;
246 struct __queue pending_xmitbuf_queue;
247 u8 *pallocated_xmitbuf;
248 u8 *pxmitbuf;
249 uint free_xmitbuf_cnt;
250 };
251
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(void *priv);
281
282 void xmitframe_xmitbuf_attach(struct xmit_frame *pxmitframe,
283 struct xmit_buf *pxmitbuf);
284
285 #include "rtl8712_xmit.h"
286
287 #endif
288