xref: /openbmc/linux/drivers/staging/vt6656/rxtx.h (revision f9d1968c)
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 "device.h"
33 #include "wcmd.h"
34 #include "baseband.h"
35 
36 #define DEFAULT_MGN_LIFETIME_RES_64us	125  /* 64us */
37 #define DEFAULT_MSDU_LIFETIME_RES_64us  8000
38 
39 /* MIC HDR data header */
40 struct vnt_mic_hdr {
41 	u8 id;
42 	u8 tx_priority;
43 	u8 mic_addr2[6];
44 	__be32 tsc_47_16;
45 	__be16 tsc_15_0;
46 	__be16 payload_len;
47 	__be16 hlen;
48 	__le16 frame_control;
49 	u8 addr1[6];
50 	u8 addr2[6];
51 	u8 addr3[6];
52 	__le16 seq_ctrl;
53 	u8 addr4[6];
54 	u16 packing; /* packing to 48 bytes */
55 } __packed;
56 
57 /* RsvTime buffer header */
58 struct vnt_rrv_time_rts {
59 	__le16 rts_rrv_time_ba;
60 	__le16 rts_rrv_time_aa;
61 	__le16 rts_rrv_time_bb;
62 	u16 wReserved;
63 	__le16 rrv_time_b;
64 	__le16 rrv_time_a;
65 } __packed;
66 
67 struct vnt_rrv_time_cts {
68 	__le16 cts_rrv_time_ba;
69 	u16 wReserved;
70 	__le16 rrv_time_b;
71 	__le16 rrv_time_a;
72 } __packed;
73 
74 struct vnt_rrv_time_ab {
75 	__le16 rts_rrv_time;
76 	__le16 rrv_time;
77 } __packed;
78 
79 /* TX data header */
80 struct vnt_tx_datahead_g {
81 	struct vnt_phy_field b;
82 	struct vnt_phy_field a;
83 	__le16 duration_b;
84 	__le16 duration_a;
85 	__le16 time_stamp_off_b;
86 	__le16 time_stamp_off_a;
87 	struct ieee80211_hdr hdr;
88 } __packed;
89 
90 struct vnt_tx_datahead_g_fb {
91 	struct vnt_phy_field b;
92 	struct vnt_phy_field a;
93 	__le16 duration_b;
94 	__le16 duration_a;
95 	__le16 duration_a_f0;
96 	__le16 duration_a_f1;
97 	__le16 time_stamp_off_b;
98 	__le16 time_stamp_off_a;
99 	struct ieee80211_hdr hdr;
100 } __packed;
101 
102 struct vnt_tx_datahead_ab {
103 	struct vnt_phy_field ab;
104 	__le16 duration;
105 	__le16 time_stamp_off;
106 	struct ieee80211_hdr hdr;
107 } __packed;
108 
109 struct vnt_tx_datahead_a_fb {
110 	struct vnt_phy_field a;
111 	__le16 duration;
112 	__le16 time_stamp_off;
113 	__le16 duration_f0;
114 	__le16 duration_f1;
115 	struct ieee80211_hdr hdr;
116 } __packed;
117 
118 /* RTS buffer header */
119 struct vnt_rts_g {
120 	struct vnt_phy_field b;
121 	struct vnt_phy_field a;
122 	__le16 duration_ba;
123 	__le16 duration_aa;
124 	__le16 duration_bb;
125 	u16 wReserved;
126 	struct ieee80211_rts data;
127 	struct vnt_tx_datahead_g data_head;
128 } __packed;
129 
130 struct vnt_rts_g_fb {
131 	struct vnt_phy_field b;
132 	struct vnt_phy_field a;
133 	__le16 duration_ba;
134 	__le16 duration_aa;
135 	__le16 duration_bb;
136 	u16 wReserved;
137 	__le16 rts_duration_ba_f0;
138 	__le16 rts_duration_aa_f0;
139 	__le16 rts_duration_ba_f1;
140 	__le16 rts_duration_aa_f1;
141 	struct ieee80211_rts data;
142 	struct vnt_tx_datahead_g_fb data_head;
143 } __packed;
144 
145 struct vnt_rts_ab {
146 	struct vnt_phy_field ab;
147 	__le16 duration;
148 	u16 wReserved;
149 	struct ieee80211_rts data;
150 	struct vnt_tx_datahead_ab data_head;
151 } __packed;
152 
153 struct vnt_rts_a_fb {
154 	struct vnt_phy_field a;
155 	__le16 duration;
156 	u16 wReserved;
157 	__le16 rts_duration_f0;
158 	__le16 rts_duration_f1;
159 	struct ieee80211_rts data;
160 	struct vnt_tx_datahead_a_fb data_head;
161 } __packed;
162 
163 /* CTS buffer header */
164 struct vnt_cts {
165 	struct vnt_phy_field b;
166 	__le16 duration_ba;
167 	u16 wReserved;
168 	struct ieee80211_cts data;
169 	u16 reserved2;
170 	struct vnt_tx_datahead_g data_head;
171 } __packed;
172 
173 struct vnt_cts_fb {
174 	struct vnt_phy_field b;
175 	__le16 duration_ba;
176 	u16 wReserved;
177 	__le16 cts_duration_ba_f0;
178 	__le16 cts_duration_ba_f1;
179 	struct ieee80211_cts data;
180 	u16 reserved2;
181 	struct vnt_tx_datahead_g_fb data_head;
182 } __packed;
183 
184 union vnt_tx_data_head {
185 	/* rts g */
186 	struct vnt_rts_g rts_g;
187 	struct vnt_rts_g_fb rts_g_fb;
188 	/* rts a/b */
189 	struct vnt_rts_ab rts_ab;
190 	struct vnt_rts_a_fb rts_a_fb;
191 	/* cts g */
192 	struct vnt_cts cts_g;
193 	struct vnt_cts_fb cts_g_fb;
194 	/* no rts/cts */
195 	struct vnt_tx_datahead_a_fb data_head_a_fb;
196 	struct vnt_tx_datahead_ab data_head_ab;
197 };
198 
199 struct vnt_tx_mic_hdr {
200 	struct vnt_mic_hdr hdr;
201 	union vnt_tx_data_head head;
202 } __packed;
203 
204 union vnt_tx {
205 	struct vnt_tx_mic_hdr mic;
206 	union vnt_tx_data_head head;
207 };
208 
209 union vnt_tx_head {
210 	struct {
211 		struct vnt_rrv_time_rts rts;
212 		union vnt_tx tx;
213 	} __packed tx_rts;
214 	struct {
215 		struct vnt_rrv_time_cts cts;
216 		union vnt_tx tx;
217 	} __packed tx_cts;
218 	struct {
219 		struct vnt_rrv_time_ab ab;
220 		union vnt_tx tx;
221 	} __packed tx_ab;
222 };
223 
224 struct vnt_tx_fifo_head {
225 	u8 tx_key[WLAN_KEY_LEN_CCMP];
226 	u16 wFIFOCtl;
227 	__le16 time_stamp;
228 	u16 wFragCtl;
229 	__le16 current_rate;
230 } __packed;
231 
232 struct vnt_tx_buffer {
233 	u8 byType;
234 	u8 byPKTNO;
235 	__le16 tx_byte_count;
236 	struct vnt_tx_fifo_head fifo_head;
237 	union vnt_tx_head tx_head;
238 } __packed;
239 
240 struct vnt_tx_short_buf_head {
241 	u16 fifo_ctl;
242 	u16 time_stamp;
243 	struct vnt_phy_field ab;
244 	__le16 duration;
245 	__le16 time_stamp_off;
246 } __packed;
247 
248 struct vnt_beacon_buffer {
249 	u8 byType;
250 	u8 byPKTNO;
251 	__le16 tx_byte_count;
252 	struct vnt_tx_short_buf_head short_head;
253 	struct ieee80211_mgmt mgmt_hdr;
254 } __packed;
255 
256 int vnt_tx_packet(struct vnt_private *, struct sk_buff *);
257 int vnt_beacon_make(struct vnt_private *, struct ieee80211_vif *);
258 int vnt_beacon_enable(struct vnt_private *, struct ieee80211_vif *,
259 	struct ieee80211_bss_conf *);
260 
261 #endif /* __RXTX_H__ */
262