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