1
2#ifndef B43legacy_XMIT_H_
3#define B43legacy_XMIT_H_
4
5#include "main.h"
6
7
8#define _b43legacy_declare_plcp_hdr(size) \
9 struct b43legacy_plcp_hdr##size { \
10 union { \
11 __le32 data; \
12 __u8 raw[size]; \
13 } __packed; \
14 } __packed
15
16
17_b43legacy_declare_plcp_hdr(4);
18
19_b43legacy_declare_plcp_hdr(6);
20
21#undef _b43legacy_declare_plcp_hdr
22
23
24
25struct b43legacy_txhdr_fw3 {
26 __le32 mac_ctl;
27 __le16 mac_frame_ctl;
28 __le16 tx_fes_time_norm;
29 __le16 phy_ctl;
30 __u8 iv[16];
31 __u8 tx_receiver[6];
32 __le16 tx_fes_time_fb;
33 struct b43legacy_plcp_hdr4 rts_plcp_fb;
34 __le16 rts_dur_fb;
35 struct b43legacy_plcp_hdr4 plcp_fb;
36 __le16 dur_fb;
37 PAD_BYTES(2);
38 __le16 cookie;
39 __le16 unknown_scb_stuff;
40 struct b43legacy_plcp_hdr6 rts_plcp;
41 __u8 rts_frame[18];
42 struct b43legacy_plcp_hdr6 plcp;
43} __packed;
44
45
46#define B43legacy_TX4_MAC_KEYIDX 0x0FF00000
47#define B43legacy_TX4_MAC_KEYIDX_SHIFT 20
48#define B43legacy_TX4_MAC_KEYALG 0x00070000
49#define B43legacy_TX4_MAC_KEYALG_SHIFT 16
50#define B43legacy_TX4_MAC_LIFETIME 0x00001000
51#define B43legacy_TX4_MAC_FRAMEBURST 0x00000800
52#define B43legacy_TX4_MAC_SENDCTS 0x00000400
53#define B43legacy_TX4_MAC_AMPDU 0x00000300
54#define B43legacy_TX4_MAC_AMPDU_SHIFT 8
55#define B43legacy_TX4_MAC_CTSFALLBACKOFDM 0x00000200
56#define B43legacy_TX4_MAC_FALLBACKOFDM 0x00000100
57#define B43legacy_TX4_MAC_5GHZ 0x00000080
58#define B43legacy_TX4_MAC_IGNPMQ 0x00000020
59#define B43legacy_TX4_MAC_HWSEQ 0x00000010
60#define B43legacy_TX4_MAC_STMSDU 0x00000008
61#define B43legacy_TX4_MAC_SENDRTS 0x00000004
62#define B43legacy_TX4_MAC_LONGFRAME 0x00000002
63#define B43legacy_TX4_MAC_ACK 0x00000001
64
65
66#define B43legacy_TX4_EFT_FBOFDM 0x0001
67#define B43legacy_TX4_EFT_RTSOFDM 0x0004
68#define B43legacy_TX4_EFT_RTSFBOFDM 0x0010
69
70
71#define B43legacy_TX4_PHY_ENC 0x0003
72#define B43legacy_TX4_PHY_ENC_CCK 0x0000
73#define B43legacy_TX4_PHY_ENC_OFDM 0x0001
74#define B43legacy_TX4_PHY_SHORTPRMBL 0x0010
75#define B43legacy_TX4_PHY_ANT 0x03C0
76#define B43legacy_TX4_PHY_ANT0 0x0000
77#define B43legacy_TX4_PHY_ANT1 0x0100
78#define B43legacy_TX4_PHY_ANTLAST 0x0300
79
80
81
82int b43legacy_generate_txhdr(struct b43legacy_wldev *dev,
83 u8 *txhdr,
84 const unsigned char *fragment_data,
85 unsigned int fragment_len,
86 struct ieee80211_tx_info *info,
87 u16 cookie);
88
89
90
91struct b43legacy_txstatus {
92 u16 cookie;
93 u16 seq;
94 u8 phy_stat;
95 u8 frame_count;
96 u8 rts_count;
97 u8 supp_reason;
98
99 u8 pm_indicated;
100 u8 intermediate;
101 u8 for_ampdu;
102 u8 acked;
103};
104
105
106enum {
107 B43legacy_TXST_SUPP_NONE,
108 B43legacy_TXST_SUPP_PMQ,
109 B43legacy_TXST_SUPP_FLUSH,
110 B43legacy_TXST_SUPP_PREV,
111 B43legacy_TXST_SUPP_CHAN,
112 B43legacy_TXST_SUPP_LIFE,
113 B43legacy_TXST_SUPP_UNDER,
114 B43legacy_TXST_SUPP_ABNACK,
115};
116
117
118struct b43legacy_hwtxstatus {
119 PAD_BYTES(4);
120 __le16 cookie;
121 u8 flags;
122 u8 count;
123 PAD_BYTES(2);
124 __le16 seq;
125 u8 phy_stat;
126 PAD_BYTES(1);
127} __packed;
128
129
130
131struct b43legacy_rxhdr_fw3 {
132 __le16 frame_len;
133 PAD_BYTES(2);
134 __le16 phy_status0;
135 __u8 jssi;
136 __u8 sig_qual;
137 PAD_BYTES(2);
138 __le16 phy_status3;
139 __le16 mac_status;
140 __le16 mac_time;
141 __le16 channel;
142} __packed;
143
144
145
146#define B43legacy_RX_PHYST0_GAINCTL 0x4000
147#define B43legacy_RX_PHYST0_PLCPHCF 0x0200
148#define B43legacy_RX_PHYST0_PLCPFV 0x0100
149#define B43legacy_RX_PHYST0_SHORTPRMBL 0x0080
150#define B43legacy_RX_PHYST0_LCRS 0x0040
151#define B43legacy_RX_PHYST0_ANT 0x0020
152#define B43legacy_RX_PHYST0_UNSRATE 0x0010
153#define B43legacy_RX_PHYST0_CLIP 0x000C
154#define B43legacy_RX_PHYST0_CLIP_SHIFT 2
155#define B43legacy_RX_PHYST0_FTYPE 0x0003
156#define B43legacy_RX_PHYST0_CCK 0x0000
157#define B43legacy_RX_PHYST0_OFDM 0x0001
158#define B43legacy_RX_PHYST0_PRE_N 0x0002
159#define B43legacy_RX_PHYST0_STD_N 0x0003
160
161
162#define B43legacy_RX_PHYST2_LNAG 0xC000
163#define B43legacy_RX_PHYST2_LNAG_SHIFT 14
164#define B43legacy_RX_PHYST2_PNAG 0x3C00
165#define B43legacy_RX_PHYST2_PNAG_SHIFT 10
166#define B43legacy_RX_PHYST2_FOFF 0x03FF
167
168
169#define B43legacy_RX_PHYST3_DIGG 0x1800
170#define B43legacy_RX_PHYST3_DIGG_SHIFT 11
171#define B43legacy_RX_PHYST3_TRSTATE 0x0400
172
173
174#define B43legacy_RX_MAC_BEACONSENT 0x00008000
175#define B43legacy_RX_MAC_KEYIDX 0x000007E0
176#define B43legacy_RX_MAC_KEYIDX_SHIFT 5
177#define B43legacy_RX_MAC_DECERR 0x00000010
178#define B43legacy_RX_MAC_DEC 0x00000008
179#define B43legacy_RX_MAC_PADDING 0x00000004
180#define B43legacy_RX_MAC_RESP 0x00000002
181#define B43legacy_RX_MAC_FCSERR 0x00000001
182
183
184#define B43legacy_RX_CHAN_GAIN 0xFC00
185#define B43legacy_RX_CHAN_GAIN_SHIFT 10
186#define B43legacy_RX_CHAN_ID 0x03FC
187#define B43legacy_RX_CHAN_ID_SHIFT 2
188#define B43legacy_RX_CHAN_PHYTYPE 0x0003
189
190
191
192u8 b43legacy_plcp_get_ratecode_cck(const u8 bitrate);
193u8 b43legacy_plcp_get_ratecode_ofdm(const u8 bitrate);
194
195void b43legacy_generate_plcp_hdr(struct b43legacy_plcp_hdr4 *plcp,
196 const u16 octets, const u8 bitrate);
197
198void b43legacy_rx(struct b43legacy_wldev *dev,
199 struct sk_buff *skb,
200 const void *_rxhdr);
201
202void b43legacy_handle_txstatus(struct b43legacy_wldev *dev,
203 const struct b43legacy_txstatus *status);
204
205void b43legacy_handle_hwtxstatus(struct b43legacy_wldev *dev,
206 const struct b43legacy_hwtxstatus *hw);
207
208void b43legacy_tx_suspend(struct b43legacy_wldev *dev);
209void b43legacy_tx_resume(struct b43legacy_wldev *dev);
210
211
212#define B43legacy_NR_QOSPARMS 22
213enum {
214 B43legacy_QOSPARM_TXOP = 0,
215 B43legacy_QOSPARM_CWMIN,
216 B43legacy_QOSPARM_CWMAX,
217 B43legacy_QOSPARM_CWCUR,
218 B43legacy_QOSPARM_AIFS,
219 B43legacy_QOSPARM_BSLOTS,
220 B43legacy_QOSPARM_REGGAP,
221 B43legacy_QOSPARM_STATUS,
222};
223
224void b43legacy_qos_init(struct b43legacy_wldev *dev);
225
226
227
228
229
230static inline
231int b43legacy_new_kidx_api(struct b43legacy_wldev *dev)
232{
233
234 return (dev->fw.rev >= 351);
235}
236static inline
237u8 b43legacy_kidx_to_fw(struct b43legacy_wldev *dev, u8 raw_kidx)
238{
239 u8 firmware_kidx;
240 if (b43legacy_new_kidx_api(dev))
241 firmware_kidx = raw_kidx;
242 else {
243 if (raw_kidx >= 4)
244 firmware_kidx = raw_kidx - 4;
245 else
246 firmware_kidx = raw_kidx;
247 }
248 return firmware_kidx;
249}
250static inline
251u8 b43legacy_kidx_to_raw(struct b43legacy_wldev *dev, u8 firmware_kidx)
252{
253 u8 raw_kidx;
254 if (b43legacy_new_kidx_api(dev))
255 raw_kidx = firmware_kidx;
256 else
257
258 raw_kidx = firmware_kidx + 4;
259 return raw_kidx;
260}
261
262#endif
263