• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
3  * All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  * File: rxtx.h
20  *
21  * Purpose:
22  *
23  * Author: Jerry Chen
24  *
25  * Date: Jun. 27, 2002
26  *
27  */
28 
29 #ifndef __RXTX_H__
30 #define __RXTX_H__
31 
32 #include "ttype.h"
33 #include "device.h"
34 #include "wcmd.h"
35 
36 /*---------------------  Export Definitions -------------------------*/
37 
38 /*---------------------  Export Variables  --------------------------*/
39 
40 /*---------------------  Export Functions  --------------------------*/
41 
42 /* MIC HDR data header */
43 struct vnt_mic_hdr {
44 	u8 id;
45 	u8 tx_priority;
46 	u8 mic_addr2[ETH_ALEN];
47 	u8 ccmp_pn[IEEE80211_CCMP_PN_LEN];
48 	__be16 payload_len;
49 	__be16 hlen;
50 	__le16 frame_control;
51 	u8 addr1[ETH_ALEN];
52 	u8 addr2[ETH_ALEN];
53 	u8 addr3[ETH_ALEN];
54 	__le16 seq_ctrl;
55 	u8 addr4[ETH_ALEN];
56 	u16 packing; /* packing to 48 bytes */
57 } __packed;
58 
59 /* RsvTime buffer header */
60 struct vnt_rrv_time_rts {
61 	__le16 rts_rrv_time_ba;
62 	__le16 rts_rrv_time_aa;
63 	__le16 rts_rrv_time_bb;
64 	u16 reserved;
65 	__le16 rrv_time_b;
66 	__le16 rrv_time_a;
67 } __packed;
68 
69 struct vnt_rrv_time_cts {
70 	__le16 cts_rrv_time_ba;
71 	u16 reserved;
72 	__le16 rrv_time_b;
73 	__le16 rrv_time_a;
74 } __packed;
75 
76 struct vnt_rrv_time_ab {
77 	__le16 rts_rrv_time;
78 	__le16 rrv_time;
79 } __packed;
80 
81 /* TX data header */
82 struct vnt_tx_datahead_g {
83 	struct vnt_phy_field b;
84 	struct vnt_phy_field a;
85 	__le16 duration_b;
86 	__le16 duration_a;
87 	__le16 time_stamp_off_b;
88 	__le16 time_stamp_off_a;
89 } __packed;
90 
91 struct vnt_tx_datahead_g_fb {
92 	struct vnt_phy_field b;
93 	struct vnt_phy_field a;
94 	__le16 duration_b;
95 	__le16 duration_a;
96 	__le16 duration_a_f0;
97 	__le16 duration_a_f1;
98 	__le16 time_stamp_off_b;
99 	__le16 time_stamp_off_a;
100 } __packed;
101 
102 struct vnt_tx_datahead_ab {
103 	struct vnt_phy_field ab;
104 	__le16 duration;
105 	__le16 time_stamp_off;
106 } __packed;
107 
108 struct vnt_tx_datahead_a_fb {
109 	struct vnt_phy_field a;
110 	__le16 duration;
111 	__le16 time_stamp_off;
112 	__le16 duration_f0;
113 	__le16 duration_f1;
114 } __packed;
115 
116 /* RTS buffer header */
117 struct vnt_rts_g {
118 	struct vnt_phy_field b;
119 	struct vnt_phy_field a;
120 	__le16 duration_ba;
121 	__le16 duration_aa;
122 	__le16 duration_bb;
123 	u16 reserved;
124 	struct ieee80211_rts data;
125 } __packed;
126 
127 struct vnt_rts_g_fb {
128 	struct vnt_phy_field b;
129 	struct vnt_phy_field a;
130 	__le16 duration_ba;
131 	__le16 duration_aa;
132 	__le16 duration_bb;
133 	u16 wReserved;
134 	__le16 rts_duration_ba_f0;
135 	__le16 rts_duration_aa_f0;
136 	__le16 rts_duration_ba_f1;
137 	__le16 rts_duration_aa_f1;
138 	struct ieee80211_rts data;
139 } __packed;
140 
141 struct vnt_rts_ab {
142 	struct vnt_phy_field ab;
143 	__le16 duration;
144 	u16 reserved;
145 	struct ieee80211_rts data;
146 } __packed;
147 
148 struct vnt_rts_a_fb {
149 	struct vnt_phy_field a;
150 	__le16 duration;
151 	u16 reserved;
152 	__le16 rts_duration_f0;
153 	__le16 rts_duration_f1;
154 	struct ieee80211_rts data;
155 } __packed;
156 
157 /* CTS buffer header */
158 struct vnt_cts {
159 	struct vnt_phy_field b;
160 	__le16 duration_ba;
161 	u16 reserved;
162 	struct ieee80211_cts data;
163 	u16 reserved2;
164 } __packed;
165 
166 struct vnt_cts_fb {
167 	struct vnt_phy_field b;
168 	__le16 duration_ba;
169 	u16 reserved;
170 	__le16 cts_duration_ba_f0;
171 	__le16 cts_duration_ba_f1;
172 	struct ieee80211_cts data;
173 	u16 reserved2;
174 } __packed;
175 
176 struct vnt_tx_short_buf_head {
177 	__le16 fifo_ctl;
178 	u16 time_stamp;
179 	struct vnt_phy_field ab;
180 	__le16 duration;
181 	__le16 time_stamp_off;
182 } __packed;
183 
184 void
185 vGenerateMACHeader(
186 	struct vnt_private *,
187 	unsigned char *pbyBufferAddr,
188 	unsigned short wDuration,
189 	PSEthernetHeader psEthHeader,
190 	bool bNeedEncrypt,
191 	unsigned short wFragType,
192 	unsigned int uDMAIdx,
193 	unsigned int uFragIdx
194 );
195 
196 unsigned int
197 cbGetFragCount(
198 	struct vnt_private *,
199 	PSKeyItem        pTransmitKey,
200 	unsigned int	cbFrameBodySize,
201 	PSEthernetHeader psEthHeader
202 );
203 
204 void
205 vGenerateFIFOHeader(struct vnt_private *, unsigned char byPktTyp,
206 		    unsigned char *pbyTxBufferAddr, bool bNeedEncrypt,
207 		    unsigned int cbPayloadSize, unsigned int uDMAIdx,
208 		    PSTxDesc pHeadTD, PSEthernetHeader psEthHeader,
209 		    unsigned char *pPacket, PSKeyItem pTransmitKey,
210 		    unsigned int uNodeIndex, unsigned int *puMACfragNum,
211 		    unsigned int *pcbHeaderSize);
212 
213 void vDMA0_tx_80211(struct vnt_private *, struct sk_buff *skb,
214 		    unsigned char *pbMPDU, unsigned int cbMPDULen);
215 CMD_STATUS csMgmt_xmit(struct vnt_private *, PSTxMgmtPacket pPacket);
216 CMD_STATUS csBeacon_xmit(struct vnt_private *, PSTxMgmtPacket pPacket);
217 
218 #endif // __RXTX_H__
219