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