blob: 145713dc41108482a3b1ea28696e357eea9b6640 [file] [log] [blame]
Forest Bond5449c682009-04-25 10:30:44 -04001/*
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 *
Jim Lieb612822f2009-08-12 14:54:03 -070019 * File: rxtx.h
Forest Bond5449c682009-04-25 10:30:44 -040020 *
21 * Purpose:
22 *
23 * Author: Jerry Chen
24 *
25 * Date: Jun. 27, 2002
26 *
27 */
28
Forest Bond5449c682009-04-25 10:30:44 -040029#ifndef __RXTX_H__
30#define __RXTX_H__
31
Forest Bond5449c682009-04-25 10:30:44 -040032#include "ttype.h"
Forest Bond5449c682009-04-25 10:30:44 -040033#include "device.h"
Forest Bond5449c682009-04-25 10:30:44 -040034#include "wcmd.h"
Forest Bond5449c682009-04-25 10:30:44 -040035
36/*--------------------- Export Definitions -------------------------*/
37
Forest Bond5449c682009-04-25 10:30:44 -040038/*--------------------- Export Variables --------------------------*/
39
40/*--------------------- Export Functions --------------------------*/
41
Malcolm Priestley11a72e52014-08-09 20:15:56 +010042/* MIC HDR data header */
43struct vnt_mic_hdr {
44 u8 id;
45 u8 tx_priority;
46 u8 mic_addr2[ETH_ALEN];
Malcolm Priestley09a903b2014-08-22 22:35:10 +010047 u8 ccmp_pn[IEEE80211_CCMP_PN_LEN];
Malcolm Priestley11a72e52014-08-09 20:15:56 +010048 __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
Malcolm Priestleya9e6a2d2014-08-30 22:25:27 +010059/* RsvTime buffer header */
60struct 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
Malcolm Priestleyd66a5a72014-08-30 22:25:28 +010069struct 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
Malcolm Priestleyf6a634c2014-08-30 22:25:29 +010076struct vnt_rrv_time_ab {
77 __le16 rts_rrv_time;
78 __le16 rrv_time;
79} __packed;
80
Malcolm Priestley72edb7e2014-08-30 22:25:34 +010081/* TX data header */
82struct 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
Malcolm Priestley2dd76672014-08-30 22:25:35 +010091struct 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
Malcolm Priestley9ce842a2014-08-30 22:25:36 +0100102struct vnt_tx_datahead_ab {
103 struct vnt_phy_field ab;
104 __le16 duration;
105 __le16 time_stamp_off;
106} __packed;
107
Malcolm Priestley9c62c7a2014-08-30 22:25:37 +0100108struct 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
Malcolm Priestley17434f02014-08-30 22:25:41 +0100116/* RTS buffer header */
117struct 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
Malcolm Priestley9587b092014-08-30 22:25:42 +0100127struct 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
Malcolm Priestleye21eb1c2014-08-30 22:25:43 +0100141struct vnt_rts_ab {
142 struct vnt_phy_field ab;
143 __le16 duration;
144 u16 reserved;
145 struct ieee80211_rts data;
146} __packed;
147
Malcolm Priestley8e448042014-08-30 22:25:44 +0100148struct 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
Malcolm Priestleyf5172b02014-08-30 22:25:45 +0100157/* CTS buffer header */
158struct 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
Malcolm Priestleydb1afd12014-08-30 22:25:46 +0100166struct 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
Malcolm Priestley01eec152014-10-29 17:43:38 +0000176struct vnt_tx_fifo_head {
177 u8 tx_key[WLAN_KEY_LEN_CCMP];
178 __le16 fifo_ctl;
179 __le16 time_stamp;
180 __le16 frag_ctl;
181 __le16 current_rate;
182} __packed;
183
Malcolm Priestley96417232014-08-22 22:35:11 +0100184struct vnt_tx_short_buf_head {
185 __le16 fifo_ctl;
186 u16 time_stamp;
187 struct vnt_phy_field ab;
188 __le16 duration;
189 __le16 time_stamp_off;
190} __packed;
191
Charles Clément6b35b7b2010-05-07 12:30:19 -0700192void
Joe Perches547f1cf2013-03-18 10:45:01 -0700193vGenerateMACHeader(
Malcolm Priestleycf76dc42014-08-10 15:46:59 +0100194 struct vnt_private *,
Joe Perches547f1cf2013-03-18 10:45:01 -0700195 unsigned char *pbyBufferAddr,
196 unsigned short wDuration,
197 PSEthernetHeader psEthHeader,
198 bool bNeedEncrypt,
199 unsigned short wFragType,
200 unsigned int uDMAIdx,
201 unsigned int uFragIdx
202);
Forest Bond5449c682009-04-25 10:30:44 -0400203
Charles Clémentb6e95cd2010-06-02 09:52:01 -0700204unsigned int
Forest Bond5449c682009-04-25 10:30:44 -0400205cbGetFragCount(
Malcolm Priestleycf76dc42014-08-10 15:46:59 +0100206 struct vnt_private *,
Joe Perches547f1cf2013-03-18 10:45:01 -0700207 PSKeyItem pTransmitKey,
208 unsigned int cbFrameBodySize,
209 PSEthernetHeader psEthHeader
210);
Forest Bond5449c682009-04-25 10:30:44 -0400211
Charles Clément6b35b7b2010-05-07 12:30:19 -0700212void
Malcolm Priestleycf76dc42014-08-10 15:46:59 +0100213vGenerateFIFOHeader(struct vnt_private *, unsigned char byPktTyp,
214 unsigned char *pbyTxBufferAddr, bool bNeedEncrypt,
215 unsigned int cbPayloadSize, unsigned int uDMAIdx,
216 PSTxDesc pHeadTD, PSEthernetHeader psEthHeader,
217 unsigned char *pPacket, PSKeyItem pTransmitKey,
218 unsigned int uNodeIndex, unsigned int *puMACfragNum,
219 unsigned int *pcbHeaderSize);
Forest Bond5449c682009-04-25 10:30:44 -0400220
Malcolm Priestleycf76dc42014-08-10 15:46:59 +0100221void vDMA0_tx_80211(struct vnt_private *, struct sk_buff *skb,
222 unsigned char *pbMPDU, unsigned int cbMPDULen);
223CMD_STATUS csMgmt_xmit(struct vnt_private *, PSTxMgmtPacket pPacket);
224CMD_STATUS csBeacon_xmit(struct vnt_private *, PSTxMgmtPacket pPacket);
Forest Bond5449c682009-04-25 10:30:44 -0400225
Malcolm Priestley01eec152014-10-29 17:43:38 +0000226int vnt_generate_fifo_header(struct vnt_private *, u32,
227 PSTxDesc head_td, struct sk_buff *);
228int vnt_beacon_make(struct vnt_private *, struct ieee80211_vif *);
229int vnt_beacon_enable(struct vnt_private *, struct ieee80211_vif *,
230 struct ieee80211_bss_conf *);
231
Forest Bond5449c682009-04-25 10:30:44 -0400232#endif // __RXTX_H__