Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
rtl871x_xmit.h
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
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  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
17  *
18  * Modifications for inclusion into the Linux staging tree are
19  * Copyright(c) 2010 Larry Finger. All rights reserved.
20  *
21  * Contact information:
22  * WLAN FAE <[email protected]>
23  * Larry Finger <[email protected]>
24  *
25  ******************************************************************************/
26 #ifndef _RTL871X_XMIT_H_
27 #define _RTL871X_XMIT_H_
28 
29 #include "osdep_service.h"
30 #include "drv_types.h"
31 #include "xmit_osdep.h"
32 
33 #ifdef CONFIG_R8712_TX_AGGR
34 #define MAX_XMITBUF_SZ (16384)
35 #else
36 #define MAX_XMITBUF_SZ (2048)
37 #endif
38 
39 #define NR_XMITBUFF (4)
40 
41 #ifdef CONFIG_R8712_TX_AGGR
42 #define AGGR_NR_HIGH_BOUND (4) /*(8) */
43 #define AGGR_NR_LOW_BOUND (2)
44 #endif
45 
46 #define XMITBUF_ALIGN_SZ 512
47 #define TX_GUARD_BAND 5
48 #define MAX_NUMBLKS (1)
49 
50 /* Fixed the Big Endian bug when using the software driver encryption.*/
51 #define WEP_IV(pattrib_iv, txpn, keyidx)\
52 do { \
53  pattrib_iv[0] = txpn._byte_.TSC0;\
54  pattrib_iv[1] = txpn._byte_.TSC1;\
55  pattrib_iv[2] = txpn._byte_.TSC2;\
56  pattrib_iv[3] = ((keyidx & 0x3)<<6);\
57  txpn.val = (txpn.val == 0xffffff) ? 0 : (txpn.val+1);\
58 } while (0)
59 
60 /* Fixed the Big Endian bug when doing the Tx.
61  * The Linksys WRH54G will check this.*/
62 #define TKIP_IV(pattrib_iv, txpn, keyidx)\
63 do { \
64  pattrib_iv[0] = txpn._byte_.TSC1;\
65  pattrib_iv[1] = (txpn._byte_.TSC1 | 0x20) & 0x7f;\
66  pattrib_iv[2] = txpn._byte_.TSC0;\
67  pattrib_iv[3] = BIT(5) | ((keyidx & 0x3)<<6);\
68  pattrib_iv[4] = txpn._byte_.TSC2;\
69  pattrib_iv[5] = txpn._byte_.TSC3;\
70  pattrib_iv[6] = txpn._byte_.TSC4;\
71  pattrib_iv[7] = txpn._byte_.TSC5;\
72  txpn.val = txpn.val == 0xffffffffffffULL ? 0 : \
73  (txpn.val+1);\
74 } while (0)
75 
76 #define AES_IV(pattrib_iv, txpn, keyidx)\
77 do { \
78  pattrib_iv[0] = txpn._byte_.TSC0;\
79  pattrib_iv[1] = txpn._byte_.TSC1;\
80  pattrib_iv[2] = 0;\
81  pattrib_iv[3] = BIT(5) | ((keyidx & 0x3)<<6);\
82  pattrib_iv[4] = txpn._byte_.TSC2;\
83  pattrib_iv[5] = txpn._byte_.TSC3;\
84  pattrib_iv[6] = txpn._byte_.TSC4;\
85  pattrib_iv[7] = txpn._byte_.TSC5;\
86  txpn.val = txpn.val == 0xffffffffffffULL ? 0 : \
87  (txpn.val+1);\
88 } while (0)
89 
90 struct hw_xmit {
93  struct __queue *sta_queue;
96  int accnt;
97 };
98 
99 struct pkt_attrib {
104 
107  u16 pktlen; /* the original 802.3 pkt raw_data len
108  * (not include ether_hdr data) */
110 
111  u8 pkt_hdrlen; /*the original 802.3 pkt header len*/
112  u8 hdrlen; /*the WLAN Header Len*/
116  u8 vcs_mode; /*virtual carrier sense method*/
117  u8 pctrl;/*per packet txdesc control enable*/
119 
121  u8 encrypt; /* when 0 indicate no encrypt. when non-zero,
122  * indicate the encrypt algorithm*/
125  unsigned char iv[8];
126  unsigned char icv[8];
131  struct sta_info *psta;
132 };
133 
134 #define WLANHDR_OFFSET 64
135 #define DATA_FRAMETAG 0x01
136 #define L2_FRAMETAG 0x02
137 #define MGNT_FRAMETAG 0x03
138 #define AMSDU_FRAMETAG 0x04
139 #define EII_FRAMETAG 0x05
140 #define IEEE8023_FRAMETAG 0x06
141 #define MP_FRAMETAG 0x07
142 #define TXAGG_FRAMETAG 0x08
143 
144 struct xmit_buf {
145  struct list_head list;
146 
149  void *priv_data;
150  struct urb *pxmit_urb[8];
152 };
153 
154 struct xmit_frame {
155  struct list_head list;
163  u16 sz[8];
164  struct urb *pxmit_urb[8];
166  u8 last[8];
167 };
168 
169 struct tx_servq {
172  int qcnt;
173 };
174 
178  sint apsd_setting; /* When bit mask is on, the associated edca
179  * queue supports APSD.*/
180  struct tx_servq be_q; /* priority == 0,3 */
181  struct tx_servq bk_q; /* priority == 1,2*/
182  struct tx_servq vi_q; /*priority == 4,5*/
183  struct tx_servq vo_q; /*priority == 6,7*/
185  struct list_head apsd;
190 };
191 
192 struct hw_txqueue {
193  /*volatile*/ sint head;
194  /*volatile*/ sint tail;
195  /*volatile*/ sint free_sz; /*in units of 64 bytes*/
196  /*volatile*/ sint free_cmdsz;
197  /*volatile*/ sint txsz[8];
201 };
202 
203 struct xmit_priv {
224  struct _adapter *adapter;
232  struct hw_xmit *hwxmits;
239  /*per AC pending irp*/
240  int beq_cnt;
241  int bkq_cnt;
242  int viq_cnt;
243  int voq_cnt;
252  int cmdseq;
258 };
259 
260 static inline struct __queue *get_free_xmit_queue(
261  struct xmit_priv *pxmitpriv)
262 {
263  return &(pxmitpriv->free_xmit_queue);
264 }
265 
266 int r8712_free_xmitbuf(struct xmit_priv *pxmitpriv,
267  struct xmit_buf *pxmitbuf);
268 struct xmit_buf *r8712_alloc_xmitbuf(struct xmit_priv *pxmitpriv);
269 void r8712_update_protection(struct _adapter *padapter, u8 *ie, uint ie_len);
270 struct xmit_frame *r8712_alloc_xmitframe(struct xmit_priv *pxmitpriv);
271 void r8712_free_xmitframe(struct xmit_priv *pxmitpriv,
272  struct xmit_frame *pxmitframe);
273 void r8712_free_xmitframe_queue(struct xmit_priv *pxmitpriv,
274  struct __queue *pframequeue);
276  struct xmit_frame *pxmitframe);
278  struct xmit_frame *pxmitframe);
279 sint _r8712_init_hw_txqueue(struct hw_txqueue *phw_txqueue, u8 ac_tag);
280 void _r8712_init_sta_xmit_priv(struct sta_xmit_priv *psta_xmitpriv);
282  struct pkt_attrib *pattrib);
284  struct pkt_attrib *pattrib);
285 sint _r8712_init_xmit_priv(struct xmit_priv *pxmitpriv,
286  struct _adapter *padapter);
287 void _free_xmit_priv(struct xmit_priv *pxmitpriv);
288 void r8712_free_xmitframe_ex(struct xmit_priv *pxmitpriv,
289  struct xmit_frame *pxmitframe);
290 int r8712_pre_xmit(struct _adapter *padapter, struct xmit_frame *pxmitframe);
292  struct xmit_frame *pxmitframe);
293 int r8712_xmit_direct(struct _adapter *padapter, struct xmit_frame *pxmitframe);
294 void r8712_xmit_bh(void *priv);
295 
296 void xmitframe_xmitbuf_attach(struct xmit_frame *pxmitframe,
297  struct xmit_buf *pxmitbuf);
298 
299 #include "rtl8712_xmit.h"
300 
301 #endif /*_RTL871X_XMIT_H_*/
302