.. | .. |
---|
13 | 13 | * |
---|
14 | 14 | * Functions: |
---|
15 | 15 | * vnt_generate_tx_parameter - Generate tx dma required parameter. |
---|
16 | | - * vnt_get_duration_le - get tx data required duration |
---|
17 | | - * vnt_get_rtscts_duration_le- get rtx/cts required duration |
---|
18 | | - * vnt_get_rtscts_rsvtime_le- get rts/cts reserved time |
---|
19 | 16 | * vnt_get_rsvtime- get frame reserved time |
---|
20 | 17 | * vnt_fill_cts_head- fulfill CTS ctl header |
---|
21 | 18 | * |
---|
.. | .. |
---|
39 | 36 | {384, 192, 130, 113, 54, 43, 37, 31, 28, 25, 24, 23}, |
---|
40 | 37 | }; |
---|
41 | 38 | |
---|
42 | | -static const u16 vnt_fb_opt0[2][5] = { |
---|
43 | | - {RATE_12M, RATE_18M, RATE_24M, RATE_36M, RATE_48M}, /* fallback_rate0 */ |
---|
44 | | - {RATE_12M, RATE_12M, RATE_18M, RATE_24M, RATE_36M}, /* fallback_rate1 */ |
---|
45 | | -}; |
---|
46 | | - |
---|
47 | | -static const u16 vnt_fb_opt1[2][5] = { |
---|
48 | | - {RATE_12M, RATE_18M, RATE_24M, RATE_24M, RATE_36M}, /* fallback_rate0 */ |
---|
49 | | - {RATE_6M, RATE_6M, RATE_12M, RATE_12M, RATE_18M}, /* fallback_rate1 */ |
---|
50 | | -}; |
---|
51 | | - |
---|
52 | | -#define RTSDUR_BB 0 |
---|
53 | | -#define RTSDUR_BA 1 |
---|
54 | | -#define RTSDUR_AA 2 |
---|
55 | | -#define CTSDUR_BA 3 |
---|
56 | | -#define RTSDUR_BA_F0 4 |
---|
57 | | -#define RTSDUR_AA_F0 5 |
---|
58 | | -#define RTSDUR_BA_F1 6 |
---|
59 | | -#define RTSDUR_AA_F1 7 |
---|
60 | | -#define CTSDUR_BA_F0 8 |
---|
61 | | -#define CTSDUR_BA_F1 9 |
---|
62 | 39 | #define DATADUR_B 10 |
---|
63 | 40 | #define DATADUR_A 11 |
---|
64 | | -#define DATADUR_A_F0 12 |
---|
65 | | -#define DATADUR_A_F1 13 |
---|
| 41 | + |
---|
| 42 | +static const u8 vnt_phy_signal[] = { |
---|
| 43 | + 0x00, /* RATE_1M */ |
---|
| 44 | + 0x01, /* RATE_2M */ |
---|
| 45 | + 0x02, /* RATE_5M */ |
---|
| 46 | + 0x03, /* RATE_11M */ |
---|
| 47 | + 0x8b, /* RATE_6M */ |
---|
| 48 | + 0x8f, /* RATE_9M */ |
---|
| 49 | + 0x8a, /* RATE_12M */ |
---|
| 50 | + 0x8e, /* RATE_18M */ |
---|
| 51 | + 0x89, /* RATE_24M */ |
---|
| 52 | + 0x8d, /* RATE_36M */ |
---|
| 53 | + 0x88, /* RATE_48M */ |
---|
| 54 | + 0x8c /* RATE_54M */ |
---|
| 55 | +}; |
---|
66 | 56 | |
---|
67 | 57 | static struct vnt_usb_send_context |
---|
68 | 58 | *vnt_get_free_context(struct vnt_private *priv) |
---|
.. | .. |
---|
79 | 69 | context = priv->tx_context[ii]; |
---|
80 | 70 | if (!context->in_use) { |
---|
81 | 71 | context->in_use = true; |
---|
82 | | - memset(context->data, 0, |
---|
83 | | - MAX_TOTAL_SIZE_WITH_ALL_HEADERS); |
---|
84 | | - |
---|
85 | | - context->hdr = NULL; |
---|
86 | | - |
---|
87 | 72 | return context; |
---|
88 | 73 | } |
---|
89 | 74 | } |
---|
.. | .. |
---|
97 | 82 | return NULL; |
---|
98 | 83 | } |
---|
99 | 84 | |
---|
| 85 | +/* Get Length, Service, and Signal fields of Phy for Tx */ |
---|
| 86 | +static void vnt_get_phy_field(struct vnt_private *priv, u32 frame_length, |
---|
| 87 | + u16 tx_rate, u8 pkt_type, |
---|
| 88 | + struct vnt_phy_field *phy) |
---|
| 89 | +{ |
---|
| 90 | + u32 bit_count; |
---|
| 91 | + u32 count = 0; |
---|
| 92 | + u32 tmp; |
---|
| 93 | + int ext_bit; |
---|
| 94 | + int i; |
---|
| 95 | + u8 mask = 0; |
---|
| 96 | + u8 preamble_type = priv->preamble_type; |
---|
| 97 | + |
---|
| 98 | + bit_count = frame_length * 8; |
---|
| 99 | + ext_bit = false; |
---|
| 100 | + |
---|
| 101 | + switch (tx_rate) { |
---|
| 102 | + case RATE_1M: |
---|
| 103 | + count = bit_count; |
---|
| 104 | + break; |
---|
| 105 | + case RATE_2M: |
---|
| 106 | + count = bit_count / 2; |
---|
| 107 | + break; |
---|
| 108 | + case RATE_5M: |
---|
| 109 | + count = DIV_ROUND_UP(bit_count * 10, 55); |
---|
| 110 | + break; |
---|
| 111 | + case RATE_11M: |
---|
| 112 | + count = bit_count / 11; |
---|
| 113 | + tmp = count * 11; |
---|
| 114 | + |
---|
| 115 | + if (tmp != bit_count) { |
---|
| 116 | + count++; |
---|
| 117 | + |
---|
| 118 | + if ((bit_count - tmp) <= 3) |
---|
| 119 | + ext_bit = true; |
---|
| 120 | + } |
---|
| 121 | + |
---|
| 122 | + break; |
---|
| 123 | + } |
---|
| 124 | + |
---|
| 125 | + if (tx_rate > RATE_11M) { |
---|
| 126 | + if (pkt_type == PK_TYPE_11A) |
---|
| 127 | + mask = BIT(4); |
---|
| 128 | + } else if (tx_rate > RATE_1M) { |
---|
| 129 | + if (preamble_type == PREAMBLE_SHORT) |
---|
| 130 | + mask = BIT(3); |
---|
| 131 | + } |
---|
| 132 | + |
---|
| 133 | + i = tx_rate > RATE_54M ? RATE_54M : tx_rate; |
---|
| 134 | + phy->signal = vnt_phy_signal[i] | mask; |
---|
| 135 | + phy->service = 0x00; |
---|
| 136 | + |
---|
| 137 | + if (pkt_type == PK_TYPE_11B) { |
---|
| 138 | + if (ext_bit) |
---|
| 139 | + phy->service |= 0x80; |
---|
| 140 | + phy->len = cpu_to_le16((u16)count); |
---|
| 141 | + } else { |
---|
| 142 | + phy->len = cpu_to_le16((u16)frame_length); |
---|
| 143 | + } |
---|
| 144 | +} |
---|
| 145 | + |
---|
100 | 146 | static __le16 vnt_time_stamp_off(struct vnt_private *priv, u16 rate) |
---|
101 | 147 | { |
---|
102 | 148 | return cpu_to_le16(vnt_time_stampoff[priv->preamble_type % 2] |
---|
103 | 149 | [rate % MAX_RATE]); |
---|
104 | 150 | } |
---|
105 | 151 | |
---|
106 | | -static u32 vnt_get_rsvtime(struct vnt_private *priv, u8 pkt_type, |
---|
107 | | - u32 frame_length, u16 rate, int need_ack) |
---|
108 | | -{ |
---|
109 | | - u32 data_time, ack_time; |
---|
110 | | - |
---|
111 | | - data_time = vnt_get_frame_time(priv->preamble_type, pkt_type, |
---|
112 | | - frame_length, rate); |
---|
113 | | - |
---|
114 | | - if (pkt_type == PK_TYPE_11B) |
---|
115 | | - ack_time = vnt_get_frame_time(priv->preamble_type, pkt_type, |
---|
116 | | - 14, (u16)priv->top_cck_basic_rate); |
---|
117 | | - else |
---|
118 | | - ack_time = vnt_get_frame_time(priv->preamble_type, pkt_type, |
---|
119 | | - 14, (u16)priv->top_ofdm_basic_rate); |
---|
120 | | - |
---|
121 | | - if (need_ack) |
---|
122 | | - return data_time + priv->sifs + ack_time; |
---|
123 | | - |
---|
124 | | - return data_time; |
---|
125 | | -} |
---|
126 | | - |
---|
127 | | -static __le16 vnt_rxtx_rsvtime_le16(struct vnt_private *priv, u8 pkt_type, |
---|
128 | | - u32 frame_length, u16 rate, int need_ack) |
---|
129 | | -{ |
---|
130 | | - return cpu_to_le16((u16)vnt_get_rsvtime(priv, pkt_type, |
---|
131 | | - frame_length, rate, need_ack)); |
---|
132 | | -} |
---|
133 | | - |
---|
134 | | -static __le16 vnt_get_rtscts_rsvtime_le(struct vnt_private *priv, u8 rsv_type, |
---|
135 | | - u8 pkt_type, u32 frame_length, |
---|
136 | | - u16 current_rate) |
---|
137 | | -{ |
---|
138 | | - u32 rrv_time, rts_time, cts_time, ack_time, data_time; |
---|
139 | | - |
---|
140 | | - rrv_time = 0; |
---|
141 | | - rts_time = 0; |
---|
142 | | - cts_time = 0; |
---|
143 | | - ack_time = 0; |
---|
144 | | - |
---|
145 | | - data_time = vnt_get_frame_time(priv->preamble_type, pkt_type, |
---|
146 | | - frame_length, current_rate); |
---|
147 | | - |
---|
148 | | - if (rsv_type == 0) { |
---|
149 | | - rts_time = vnt_get_frame_time(priv->preamble_type, pkt_type, |
---|
150 | | - 20, priv->top_cck_basic_rate); |
---|
151 | | - ack_time = vnt_get_frame_time(priv->preamble_type, |
---|
152 | | - pkt_type, 14, |
---|
153 | | - priv->top_cck_basic_rate); |
---|
154 | | - cts_time = ack_time; |
---|
155 | | - |
---|
156 | | - } else if (rsv_type == 1) { |
---|
157 | | - rts_time = vnt_get_frame_time(priv->preamble_type, pkt_type, |
---|
158 | | - 20, priv->top_cck_basic_rate); |
---|
159 | | - cts_time = vnt_get_frame_time(priv->preamble_type, pkt_type, |
---|
160 | | - 14, priv->top_cck_basic_rate); |
---|
161 | | - ack_time = vnt_get_frame_time(priv->preamble_type, pkt_type, |
---|
162 | | - 14, priv->top_ofdm_basic_rate); |
---|
163 | | - } else if (rsv_type == 2) { |
---|
164 | | - rts_time = vnt_get_frame_time(priv->preamble_type, pkt_type, |
---|
165 | | - 20, priv->top_ofdm_basic_rate); |
---|
166 | | - ack_time = vnt_get_frame_time(priv->preamble_type, |
---|
167 | | - pkt_type, 14, |
---|
168 | | - priv->top_ofdm_basic_rate); |
---|
169 | | - cts_time = ack_time; |
---|
170 | | - |
---|
171 | | - } else if (rsv_type == 3) { |
---|
172 | | - cts_time = vnt_get_frame_time(priv->preamble_type, pkt_type, |
---|
173 | | - 14, priv->top_cck_basic_rate); |
---|
174 | | - ack_time = vnt_get_frame_time(priv->preamble_type, pkt_type, |
---|
175 | | - 14, priv->top_ofdm_basic_rate); |
---|
176 | | - |
---|
177 | | - rrv_time = cts_time + ack_time + data_time + 2 * priv->sifs; |
---|
178 | | - |
---|
179 | | - return cpu_to_le16((u16)rrv_time); |
---|
180 | | - } |
---|
181 | | - |
---|
182 | | - rrv_time = rts_time + cts_time + ack_time + data_time + 3 * priv->sifs; |
---|
183 | | - |
---|
184 | | - return cpu_to_le16((u16)rrv_time); |
---|
185 | | -} |
---|
186 | | - |
---|
187 | | -static __le16 vnt_get_duration_le(struct vnt_private *priv, u8 pkt_type, |
---|
188 | | - int need_ack) |
---|
189 | | -{ |
---|
190 | | - u32 ack_time = 0; |
---|
191 | | - |
---|
192 | | - if (need_ack) { |
---|
193 | | - if (pkt_type == PK_TYPE_11B) |
---|
194 | | - ack_time = vnt_get_frame_time(priv->preamble_type, |
---|
195 | | - pkt_type, 14, |
---|
196 | | - priv->top_cck_basic_rate); |
---|
197 | | - else |
---|
198 | | - ack_time = vnt_get_frame_time(priv->preamble_type, |
---|
199 | | - pkt_type, 14, |
---|
200 | | - priv->top_ofdm_basic_rate); |
---|
201 | | - |
---|
202 | | - return cpu_to_le16((u16)(priv->sifs + ack_time)); |
---|
203 | | - } |
---|
204 | | - |
---|
205 | | - return 0; |
---|
206 | | -} |
---|
207 | | - |
---|
208 | | -static __le16 vnt_get_rtscts_duration_le(struct vnt_usb_send_context *context, |
---|
209 | | - u8 dur_type, u8 pkt_type, u16 rate) |
---|
| 152 | +static __le16 vnt_rxtx_rsvtime_le16(struct vnt_usb_send_context *context) |
---|
210 | 153 | { |
---|
211 | 154 | struct vnt_private *priv = context->priv; |
---|
212 | | - u32 cts_time = 0, dur_time = 0; |
---|
213 | | - u32 frame_length = context->frame_len; |
---|
214 | | - u8 need_ack = context->need_ack; |
---|
| 155 | + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(context->skb); |
---|
| 156 | + struct ieee80211_rate *rate = ieee80211_get_tx_rate(priv->hw, info); |
---|
215 | 157 | |
---|
216 | | - switch (dur_type) { |
---|
217 | | - case RTSDUR_BB: |
---|
218 | | - case RTSDUR_BA: |
---|
219 | | - case RTSDUR_BA_F0: |
---|
220 | | - case RTSDUR_BA_F1: |
---|
221 | | - cts_time = vnt_get_frame_time(priv->preamble_type, pkt_type, |
---|
222 | | - 14, priv->top_cck_basic_rate); |
---|
223 | | - dur_time = cts_time + 2 * priv->sifs + |
---|
224 | | - vnt_get_rsvtime(priv, pkt_type, |
---|
225 | | - frame_length, rate, need_ack); |
---|
226 | | - break; |
---|
227 | | - |
---|
228 | | - case RTSDUR_AA: |
---|
229 | | - case RTSDUR_AA_F0: |
---|
230 | | - case RTSDUR_AA_F1: |
---|
231 | | - cts_time = vnt_get_frame_time(priv->preamble_type, pkt_type, |
---|
232 | | - 14, priv->top_ofdm_basic_rate); |
---|
233 | | - dur_time = cts_time + 2 * priv->sifs + |
---|
234 | | - vnt_get_rsvtime(priv, pkt_type, |
---|
235 | | - frame_length, rate, need_ack); |
---|
236 | | - break; |
---|
237 | | - |
---|
238 | | - case CTSDUR_BA: |
---|
239 | | - case CTSDUR_BA_F0: |
---|
240 | | - case CTSDUR_BA_F1: |
---|
241 | | - dur_time = priv->sifs + vnt_get_rsvtime(priv, |
---|
242 | | - pkt_type, frame_length, rate, need_ack); |
---|
243 | | - break; |
---|
244 | | - |
---|
245 | | - default: |
---|
246 | | - break; |
---|
247 | | - } |
---|
248 | | - |
---|
249 | | - return cpu_to_le16((u16)dur_time); |
---|
| 158 | + return ieee80211_generic_frame_duration(priv->hw, |
---|
| 159 | + info->control.vif, info->band, |
---|
| 160 | + context->frame_len, |
---|
| 161 | + rate); |
---|
250 | 162 | } |
---|
251 | 163 | |
---|
252 | | -static u16 vnt_mac_hdr_pos(struct vnt_usb_send_context *tx_context, |
---|
253 | | - struct ieee80211_hdr *hdr) |
---|
| 164 | +static __le16 vnt_get_rts_duration(struct vnt_usb_send_context *context) |
---|
254 | 165 | { |
---|
255 | | - u8 *head = tx_context->data + offsetof(struct vnt_tx_buffer, fifo_head); |
---|
256 | | - u8 *hdr_pos = (u8 *)hdr; |
---|
| 166 | + struct vnt_private *priv = context->priv; |
---|
| 167 | + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(context->skb); |
---|
257 | 168 | |
---|
258 | | - tx_context->hdr = hdr; |
---|
259 | | - if (!tx_context->hdr) |
---|
260 | | - return 0; |
---|
261 | | - |
---|
262 | | - return (u16)(hdr_pos - head); |
---|
| 169 | + return ieee80211_rts_duration(priv->hw, priv->vif, |
---|
| 170 | + context->frame_len, info); |
---|
263 | 171 | } |
---|
264 | 172 | |
---|
265 | | -static u16 vnt_rxtx_datahead_g(struct vnt_usb_send_context *tx_context, |
---|
266 | | - struct vnt_tx_datahead_g *buf) |
---|
| 173 | +static __le16 vnt_get_cts_duration(struct vnt_usb_send_context *context) |
---|
| 174 | +{ |
---|
| 175 | + struct vnt_private *priv = context->priv; |
---|
| 176 | + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(context->skb); |
---|
| 177 | + |
---|
| 178 | + return ieee80211_ctstoself_duration(priv->hw, priv->vif, |
---|
| 179 | + context->frame_len, info); |
---|
| 180 | +} |
---|
| 181 | + |
---|
| 182 | +static void vnt_rxtx_datahead_g(struct vnt_usb_send_context *tx_context, |
---|
| 183 | + struct vnt_tx_datahead_g *buf) |
---|
267 | 184 | { |
---|
268 | 185 | struct vnt_private *priv = tx_context->priv; |
---|
269 | 186 | struct ieee80211_hdr *hdr = |
---|
270 | 187 | (struct ieee80211_hdr *)tx_context->skb->data; |
---|
271 | 188 | u32 frame_len = tx_context->frame_len; |
---|
272 | 189 | u16 rate = tx_context->tx_rate; |
---|
273 | | - u8 need_ack = tx_context->need_ack; |
---|
274 | 190 | |
---|
275 | 191 | /* Get SignalField,ServiceField,Length */ |
---|
276 | 192 | vnt_get_phy_field(priv, frame_len, rate, tx_context->pkt_type, &buf->a); |
---|
.. | .. |
---|
278 | 194 | PK_TYPE_11B, &buf->b); |
---|
279 | 195 | |
---|
280 | 196 | /* Get Duration and TimeStamp */ |
---|
281 | | - if (ieee80211_is_nullfunc(hdr->frame_control)) { |
---|
282 | | - buf->duration_a = hdr->duration_id; |
---|
283 | | - buf->duration_b = hdr->duration_id; |
---|
284 | | - } else { |
---|
285 | | - buf->duration_a = vnt_get_duration_le(priv, |
---|
286 | | - tx_context->pkt_type, need_ack); |
---|
287 | | - buf->duration_b = vnt_get_duration_le(priv, |
---|
288 | | - PK_TYPE_11B, need_ack); |
---|
289 | | - } |
---|
290 | | - |
---|
| 197 | + buf->duration_a = hdr->duration_id; |
---|
| 198 | + buf->duration_b = hdr->duration_id; |
---|
291 | 199 | buf->time_stamp_off_a = vnt_time_stamp_off(priv, rate); |
---|
292 | 200 | buf->time_stamp_off_b = vnt_time_stamp_off(priv, |
---|
293 | | - priv->top_cck_basic_rate); |
---|
294 | | - |
---|
295 | | - tx_context->tx_hdr_size = vnt_mac_hdr_pos(tx_context, &buf->hdr); |
---|
296 | | - |
---|
297 | | - return le16_to_cpu(buf->duration_a); |
---|
| 201 | + priv->top_cck_basic_rate); |
---|
298 | 202 | } |
---|
299 | 203 | |
---|
300 | | -static u16 vnt_rxtx_datahead_g_fb(struct vnt_usb_send_context *tx_context, |
---|
301 | | - struct vnt_tx_datahead_g_fb *buf) |
---|
302 | | -{ |
---|
303 | | - struct vnt_private *priv = tx_context->priv; |
---|
304 | | - u32 frame_len = tx_context->frame_len; |
---|
305 | | - u16 rate = tx_context->tx_rate; |
---|
306 | | - u8 need_ack = tx_context->need_ack; |
---|
307 | | - |
---|
308 | | - /* Get SignalField,ServiceField,Length */ |
---|
309 | | - vnt_get_phy_field(priv, frame_len, rate, tx_context->pkt_type, &buf->a); |
---|
310 | | - |
---|
311 | | - vnt_get_phy_field(priv, frame_len, priv->top_cck_basic_rate, |
---|
312 | | - PK_TYPE_11B, &buf->b); |
---|
313 | | - |
---|
314 | | - /* Get Duration and TimeStamp */ |
---|
315 | | - buf->duration_a = vnt_get_duration_le(priv, tx_context->pkt_type, |
---|
316 | | - need_ack); |
---|
317 | | - buf->duration_b = vnt_get_duration_le(priv, PK_TYPE_11B, need_ack); |
---|
318 | | - |
---|
319 | | - buf->duration_a_f0 = vnt_get_duration_le(priv, tx_context->pkt_type, |
---|
320 | | - need_ack); |
---|
321 | | - buf->duration_a_f1 = vnt_get_duration_le(priv, tx_context->pkt_type, |
---|
322 | | - need_ack); |
---|
323 | | - |
---|
324 | | - buf->time_stamp_off_a = vnt_time_stamp_off(priv, rate); |
---|
325 | | - buf->time_stamp_off_b = vnt_time_stamp_off(priv, |
---|
326 | | - priv->top_cck_basic_rate); |
---|
327 | | - |
---|
328 | | - tx_context->tx_hdr_size = vnt_mac_hdr_pos(tx_context, &buf->hdr); |
---|
329 | | - |
---|
330 | | - return le16_to_cpu(buf->duration_a); |
---|
331 | | -} |
---|
332 | | - |
---|
333 | | -static u16 vnt_rxtx_datahead_a_fb(struct vnt_usb_send_context *tx_context, |
---|
334 | | - struct vnt_tx_datahead_a_fb *buf) |
---|
335 | | -{ |
---|
336 | | - struct vnt_private *priv = tx_context->priv; |
---|
337 | | - u16 rate = tx_context->tx_rate; |
---|
338 | | - u8 pkt_type = tx_context->pkt_type; |
---|
339 | | - u8 need_ack = tx_context->need_ack; |
---|
340 | | - u32 frame_len = tx_context->frame_len; |
---|
341 | | - |
---|
342 | | - /* Get SignalField,ServiceField,Length */ |
---|
343 | | - vnt_get_phy_field(priv, frame_len, rate, pkt_type, &buf->a); |
---|
344 | | - /* Get Duration and TimeStampOff */ |
---|
345 | | - buf->duration = vnt_get_duration_le(priv, pkt_type, need_ack); |
---|
346 | | - |
---|
347 | | - buf->duration_f0 = vnt_get_duration_le(priv, pkt_type, need_ack); |
---|
348 | | - buf->duration_f1 = vnt_get_duration_le(priv, pkt_type, need_ack); |
---|
349 | | - |
---|
350 | | - buf->time_stamp_off = vnt_time_stamp_off(priv, rate); |
---|
351 | | - |
---|
352 | | - tx_context->tx_hdr_size = vnt_mac_hdr_pos(tx_context, &buf->hdr); |
---|
353 | | - |
---|
354 | | - return le16_to_cpu(buf->duration); |
---|
355 | | -} |
---|
356 | | - |
---|
357 | | -static u16 vnt_rxtx_datahead_ab(struct vnt_usb_send_context *tx_context, |
---|
358 | | - struct vnt_tx_datahead_ab *buf) |
---|
| 204 | +static void vnt_rxtx_datahead_ab(struct vnt_usb_send_context *tx_context, |
---|
| 205 | + struct vnt_tx_datahead_ab *buf) |
---|
359 | 206 | { |
---|
360 | 207 | struct vnt_private *priv = tx_context->priv; |
---|
361 | 208 | struct ieee80211_hdr *hdr = |
---|
362 | 209 | (struct ieee80211_hdr *)tx_context->skb->data; |
---|
363 | 210 | u32 frame_len = tx_context->frame_len; |
---|
364 | 211 | u16 rate = tx_context->tx_rate; |
---|
365 | | - u8 need_ack = tx_context->need_ack; |
---|
366 | 212 | |
---|
367 | 213 | /* Get SignalField,ServiceField,Length */ |
---|
368 | 214 | vnt_get_phy_field(priv, frame_len, rate, |
---|
369 | 215 | tx_context->pkt_type, &buf->ab); |
---|
370 | 216 | |
---|
371 | 217 | /* Get Duration and TimeStampOff */ |
---|
372 | | - if (ieee80211_is_nullfunc(hdr->frame_control)) { |
---|
373 | | - buf->duration = hdr->duration_id; |
---|
374 | | - } else { |
---|
375 | | - buf->duration = vnt_get_duration_le(priv, tx_context->pkt_type, |
---|
376 | | - need_ack); |
---|
377 | | - } |
---|
378 | | - |
---|
| 218 | + buf->duration = hdr->duration_id; |
---|
379 | 219 | buf->time_stamp_off = vnt_time_stamp_off(priv, rate); |
---|
380 | | - |
---|
381 | | - tx_context->tx_hdr_size = vnt_mac_hdr_pos(tx_context, &buf->hdr); |
---|
382 | | - |
---|
383 | | - return le16_to_cpu(buf->duration); |
---|
384 | 220 | } |
---|
385 | 221 | |
---|
386 | | -static int vnt_fill_ieee80211_rts(struct vnt_usb_send_context *tx_context, |
---|
387 | | - struct ieee80211_rts *rts, __le16 duration) |
---|
| 222 | +static void vnt_fill_ieee80211_rts(struct vnt_usb_send_context *tx_context, |
---|
| 223 | + struct ieee80211_rts *rts, __le16 duration) |
---|
388 | 224 | { |
---|
389 | 225 | struct ieee80211_hdr *hdr = |
---|
390 | 226 | (struct ieee80211_hdr *)tx_context->skb->data; |
---|
.. | .. |
---|
395 | 231 | |
---|
396 | 232 | ether_addr_copy(rts->ra, hdr->addr1); |
---|
397 | 233 | ether_addr_copy(rts->ta, hdr->addr2); |
---|
398 | | - |
---|
399 | | - return 0; |
---|
400 | 234 | } |
---|
401 | 235 | |
---|
402 | | -static u16 vnt_rxtx_rts_g_head(struct vnt_usb_send_context *tx_context, |
---|
403 | | - struct vnt_rts_g *buf) |
---|
| 236 | +static void vnt_rxtx_rts_g_head(struct vnt_usb_send_context *tx_context, |
---|
| 237 | + struct vnt_rts_g *buf) |
---|
404 | 238 | { |
---|
405 | 239 | struct vnt_private *priv = tx_context->priv; |
---|
406 | | - u16 rts_frame_len = 20; |
---|
407 | | - u16 current_rate = tx_context->tx_rate; |
---|
408 | | - |
---|
409 | | - vnt_get_phy_field(priv, rts_frame_len, priv->top_cck_basic_rate, |
---|
410 | | - PK_TYPE_11B, &buf->b); |
---|
411 | | - vnt_get_phy_field(priv, rts_frame_len, priv->top_ofdm_basic_rate, |
---|
412 | | - tx_context->pkt_type, &buf->a); |
---|
413 | | - |
---|
414 | | - buf->duration_bb = vnt_get_rtscts_duration_le(tx_context, RTSDUR_BB, |
---|
415 | | - PK_TYPE_11B, |
---|
416 | | - priv->top_cck_basic_rate); |
---|
417 | | - buf->duration_aa = vnt_get_rtscts_duration_le(tx_context, RTSDUR_AA, |
---|
418 | | - tx_context->pkt_type, |
---|
419 | | - current_rate); |
---|
420 | | - buf->duration_ba = vnt_get_rtscts_duration_le(tx_context, RTSDUR_BA, |
---|
421 | | - tx_context->pkt_type, |
---|
422 | | - current_rate); |
---|
423 | | - |
---|
424 | | - vnt_fill_ieee80211_rts(tx_context, &buf->data, buf->duration_aa); |
---|
425 | | - |
---|
426 | | - return vnt_rxtx_datahead_g(tx_context, &buf->data_head); |
---|
427 | | -} |
---|
428 | | - |
---|
429 | | -static u16 vnt_rxtx_rts_g_fb_head(struct vnt_usb_send_context *tx_context, |
---|
430 | | - struct vnt_rts_g_fb *buf) |
---|
431 | | -{ |
---|
432 | | - struct vnt_private *priv = tx_context->priv; |
---|
433 | | - u16 current_rate = tx_context->tx_rate; |
---|
434 | 240 | u16 rts_frame_len = 20; |
---|
435 | 241 | |
---|
436 | 242 | vnt_get_phy_field(priv, rts_frame_len, priv->top_cck_basic_rate, |
---|
.. | .. |
---|
438 | 244 | vnt_get_phy_field(priv, rts_frame_len, priv->top_ofdm_basic_rate, |
---|
439 | 245 | tx_context->pkt_type, &buf->a); |
---|
440 | 246 | |
---|
441 | | - buf->duration_bb = vnt_get_rtscts_duration_le(tx_context, RTSDUR_BB, |
---|
442 | | - PK_TYPE_11B, |
---|
443 | | - priv->top_cck_basic_rate); |
---|
444 | | - buf->duration_aa = vnt_get_rtscts_duration_le(tx_context, RTSDUR_AA, |
---|
445 | | - tx_context->pkt_type, |
---|
446 | | - current_rate); |
---|
447 | | - buf->duration_ba = vnt_get_rtscts_duration_le(tx_context, RTSDUR_BA, |
---|
448 | | - tx_context->pkt_type, |
---|
449 | | - current_rate); |
---|
450 | | - |
---|
451 | | - buf->rts_duration_ba_f0 = |
---|
452 | | - vnt_get_rtscts_duration_le(tx_context, RTSDUR_BA_F0, |
---|
453 | | - tx_context->pkt_type, |
---|
454 | | - priv->tx_rate_fb0); |
---|
455 | | - buf->rts_duration_aa_f0 = |
---|
456 | | - vnt_get_rtscts_duration_le(tx_context, RTSDUR_AA_F0, |
---|
457 | | - tx_context->pkt_type, |
---|
458 | | - priv->tx_rate_fb0); |
---|
459 | | - buf->rts_duration_ba_f1 = |
---|
460 | | - vnt_get_rtscts_duration_le(tx_context, RTSDUR_BA_F1, |
---|
461 | | - tx_context->pkt_type, |
---|
462 | | - priv->tx_rate_fb1); |
---|
463 | | - buf->rts_duration_aa_f1 = |
---|
464 | | - vnt_get_rtscts_duration_le(tx_context, RTSDUR_AA_F1, |
---|
465 | | - tx_context->pkt_type, |
---|
466 | | - priv->tx_rate_fb1); |
---|
| 247 | + buf->duration_bb = vnt_get_rts_duration(tx_context); |
---|
| 248 | + buf->duration_aa = buf->duration_bb; |
---|
| 249 | + buf->duration_ba = buf->duration_bb; |
---|
467 | 250 | |
---|
468 | 251 | vnt_fill_ieee80211_rts(tx_context, &buf->data, buf->duration_aa); |
---|
469 | 252 | |
---|
470 | | - return vnt_rxtx_datahead_g_fb(tx_context, &buf->data_head); |
---|
| 253 | + vnt_rxtx_datahead_g(tx_context, &buf->data_head); |
---|
471 | 254 | } |
---|
472 | 255 | |
---|
473 | | -static u16 vnt_rxtx_rts_ab_head(struct vnt_usb_send_context *tx_context, |
---|
474 | | - struct vnt_rts_ab *buf) |
---|
| 256 | +static void vnt_rxtx_rts_ab_head(struct vnt_usb_send_context *tx_context, |
---|
| 257 | + struct vnt_rts_ab *buf) |
---|
475 | 258 | { |
---|
476 | 259 | struct vnt_private *priv = tx_context->priv; |
---|
477 | | - u16 current_rate = tx_context->tx_rate; |
---|
478 | 260 | u16 rts_frame_len = 20; |
---|
479 | 261 | |
---|
480 | 262 | vnt_get_phy_field(priv, rts_frame_len, priv->top_ofdm_basic_rate, |
---|
481 | 263 | tx_context->pkt_type, &buf->ab); |
---|
482 | 264 | |
---|
483 | | - buf->duration = vnt_get_rtscts_duration_le(tx_context, RTSDUR_AA, |
---|
484 | | - tx_context->pkt_type, |
---|
485 | | - current_rate); |
---|
| 265 | + buf->duration = vnt_get_rts_duration(tx_context); |
---|
486 | 266 | |
---|
487 | 267 | vnt_fill_ieee80211_rts(tx_context, &buf->data, buf->duration); |
---|
488 | 268 | |
---|
489 | | - return vnt_rxtx_datahead_ab(tx_context, &buf->data_head); |
---|
| 269 | + vnt_rxtx_datahead_ab(tx_context, &buf->data_head); |
---|
490 | 270 | } |
---|
491 | 271 | |
---|
492 | | -static u16 vnt_rxtx_rts_a_fb_head(struct vnt_usb_send_context *tx_context, |
---|
493 | | - struct vnt_rts_a_fb *buf) |
---|
494 | | -{ |
---|
495 | | - struct vnt_private *priv = tx_context->priv; |
---|
496 | | - u16 current_rate = tx_context->tx_rate; |
---|
497 | | - u16 rts_frame_len = 20; |
---|
498 | | - |
---|
499 | | - vnt_get_phy_field(priv, rts_frame_len, priv->top_ofdm_basic_rate, |
---|
500 | | - tx_context->pkt_type, &buf->a); |
---|
501 | | - |
---|
502 | | - buf->duration = vnt_get_rtscts_duration_le(tx_context, RTSDUR_AA, |
---|
503 | | - tx_context->pkt_type, |
---|
504 | | - current_rate); |
---|
505 | | - |
---|
506 | | - buf->rts_duration_f0 = |
---|
507 | | - vnt_get_rtscts_duration_le(tx_context, RTSDUR_AA_F0, |
---|
508 | | - tx_context->pkt_type, |
---|
509 | | - priv->tx_rate_fb0); |
---|
510 | | - |
---|
511 | | - buf->rts_duration_f1 = |
---|
512 | | - vnt_get_rtscts_duration_le(tx_context, RTSDUR_AA_F1, |
---|
513 | | - tx_context->pkt_type, |
---|
514 | | - priv->tx_rate_fb1); |
---|
515 | | - |
---|
516 | | - vnt_fill_ieee80211_rts(tx_context, &buf->data, buf->duration); |
---|
517 | | - |
---|
518 | | - return vnt_rxtx_datahead_a_fb(tx_context, &buf->data_head); |
---|
519 | | -} |
---|
520 | | - |
---|
521 | | -static u16 vnt_fill_cts_fb_head(struct vnt_usb_send_context *tx_context, |
---|
522 | | - union vnt_tx_data_head *head) |
---|
523 | | -{ |
---|
524 | | - struct vnt_private *priv = tx_context->priv; |
---|
525 | | - struct vnt_cts_fb *buf = &head->cts_g_fb; |
---|
526 | | - u32 cts_frame_len = 14; |
---|
527 | | - u16 current_rate = tx_context->tx_rate; |
---|
528 | | - |
---|
529 | | - /* Get SignalField,ServiceField,Length */ |
---|
530 | | - vnt_get_phy_field(priv, cts_frame_len, priv->top_cck_basic_rate, |
---|
531 | | - PK_TYPE_11B, &buf->b); |
---|
532 | | - |
---|
533 | | - buf->duration_ba = |
---|
534 | | - vnt_get_rtscts_duration_le(tx_context, CTSDUR_BA, |
---|
535 | | - tx_context->pkt_type, |
---|
536 | | - current_rate); |
---|
537 | | - /* Get CTSDuration_ba_f0 */ |
---|
538 | | - buf->cts_duration_ba_f0 = |
---|
539 | | - vnt_get_rtscts_duration_le(tx_context, CTSDUR_BA_F0, |
---|
540 | | - tx_context->pkt_type, |
---|
541 | | - priv->tx_rate_fb0); |
---|
542 | | - /* Get CTSDuration_ba_f1 */ |
---|
543 | | - buf->cts_duration_ba_f1 = |
---|
544 | | - vnt_get_rtscts_duration_le(tx_context, CTSDUR_BA_F1, |
---|
545 | | - tx_context->pkt_type, |
---|
546 | | - priv->tx_rate_fb1); |
---|
547 | | - /* Get CTS Frame body */ |
---|
548 | | - buf->data.duration = buf->duration_ba; |
---|
549 | | - buf->data.frame_control = |
---|
550 | | - cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS); |
---|
551 | | - |
---|
552 | | - ether_addr_copy(buf->data.ra, priv->current_net_addr); |
---|
553 | | - |
---|
554 | | - return vnt_rxtx_datahead_g_fb(tx_context, &buf->data_head); |
---|
555 | | -} |
---|
556 | | - |
---|
557 | | -static u16 vnt_fill_cts_head(struct vnt_usb_send_context *tx_context, |
---|
558 | | - union vnt_tx_data_head *head) |
---|
| 272 | +static void vnt_fill_cts_head(struct vnt_usb_send_context *tx_context, |
---|
| 273 | + union vnt_tx_data_head *head) |
---|
559 | 274 | { |
---|
560 | 275 | struct vnt_private *priv = tx_context->priv; |
---|
561 | 276 | struct vnt_cts *buf = &head->cts_g; |
---|
562 | 277 | u32 cts_frame_len = 14; |
---|
563 | | - u16 current_rate = tx_context->tx_rate; |
---|
564 | 278 | |
---|
565 | 279 | /* Get SignalField,ServiceField,Length */ |
---|
566 | 280 | vnt_get_phy_field(priv, cts_frame_len, priv->top_cck_basic_rate, |
---|
567 | 281 | PK_TYPE_11B, &buf->b); |
---|
568 | 282 | /* Get CTSDuration_ba */ |
---|
569 | | - buf->duration_ba = |
---|
570 | | - vnt_get_rtscts_duration_le(tx_context, CTSDUR_BA, |
---|
571 | | - tx_context->pkt_type, |
---|
572 | | - current_rate); |
---|
| 283 | + buf->duration_ba = vnt_get_cts_duration(tx_context); |
---|
573 | 284 | /*Get CTS Frame body*/ |
---|
574 | 285 | buf->data.duration = buf->duration_ba; |
---|
575 | 286 | buf->data.frame_control = |
---|
.. | .. |
---|
577 | 288 | |
---|
578 | 289 | ether_addr_copy(buf->data.ra, priv->current_net_addr); |
---|
579 | 290 | |
---|
580 | | - return vnt_rxtx_datahead_g(tx_context, &buf->data_head); |
---|
| 291 | + vnt_rxtx_datahead_g(tx_context, &buf->data_head); |
---|
581 | 292 | } |
---|
582 | 293 | |
---|
583 | | -static u16 vnt_rxtx_rts(struct vnt_usb_send_context *tx_context, |
---|
584 | | - union vnt_tx_head *tx_head, bool need_mic) |
---|
| 294 | +/* returns true if mic_hdr is needed */ |
---|
| 295 | +static bool vnt_fill_txkey(struct vnt_tx_buffer *tx_buffer, struct sk_buff *skb) |
---|
585 | 296 | { |
---|
586 | | - struct vnt_private *priv = tx_context->priv; |
---|
587 | | - struct vnt_rrv_time_rts *buf = &tx_head->tx_rts.rts; |
---|
588 | | - union vnt_tx_data_head *head = &tx_head->tx_rts.tx.head; |
---|
589 | | - u32 frame_len = tx_context->frame_len; |
---|
590 | | - u16 current_rate = tx_context->tx_rate; |
---|
591 | | - u8 need_ack = tx_context->need_ack; |
---|
592 | | - |
---|
593 | | - buf->rts_rrv_time_aa = vnt_get_rtscts_rsvtime_le(priv, 2, |
---|
594 | | - tx_context->pkt_type, frame_len, current_rate); |
---|
595 | | - buf->rts_rrv_time_ba = vnt_get_rtscts_rsvtime_le(priv, 1, |
---|
596 | | - tx_context->pkt_type, frame_len, current_rate); |
---|
597 | | - buf->rts_rrv_time_bb = vnt_get_rtscts_rsvtime_le(priv, 0, |
---|
598 | | - tx_context->pkt_type, frame_len, current_rate); |
---|
599 | | - |
---|
600 | | - buf->rrv_time_a = vnt_rxtx_rsvtime_le16(priv, tx_context->pkt_type, |
---|
601 | | - frame_len, current_rate, |
---|
602 | | - need_ack); |
---|
603 | | - buf->rrv_time_b = vnt_rxtx_rsvtime_le16(priv, PK_TYPE_11B, frame_len, |
---|
604 | | - priv->top_cck_basic_rate, need_ack); |
---|
605 | | - |
---|
606 | | - if (need_mic) |
---|
607 | | - head = &tx_head->tx_rts.tx.mic.head; |
---|
608 | | - |
---|
609 | | - if (tx_context->fb_option) |
---|
610 | | - return vnt_rxtx_rts_g_fb_head(tx_context, &head->rts_g_fb); |
---|
611 | | - |
---|
612 | | - return vnt_rxtx_rts_g_head(tx_context, &head->rts_g); |
---|
613 | | -} |
---|
614 | | - |
---|
615 | | -static u16 vnt_rxtx_cts(struct vnt_usb_send_context *tx_context, |
---|
616 | | - union vnt_tx_head *tx_head, bool need_mic) |
---|
617 | | -{ |
---|
618 | | - struct vnt_private *priv = tx_context->priv; |
---|
619 | | - struct vnt_rrv_time_cts *buf = &tx_head->tx_cts.cts; |
---|
620 | | - union vnt_tx_data_head *head = &tx_head->tx_cts.tx.head; |
---|
621 | | - u32 frame_len = tx_context->frame_len; |
---|
622 | | - u16 current_rate = tx_context->tx_rate; |
---|
623 | | - u8 need_ack = tx_context->need_ack; |
---|
624 | | - |
---|
625 | | - buf->rrv_time_a = vnt_rxtx_rsvtime_le16(priv, tx_context->pkt_type, |
---|
626 | | - frame_len, current_rate, need_ack); |
---|
627 | | - buf->rrv_time_b = vnt_rxtx_rsvtime_le16(priv, PK_TYPE_11B, |
---|
628 | | - frame_len, priv->top_cck_basic_rate, need_ack); |
---|
629 | | - |
---|
630 | | - buf->cts_rrv_time_ba = vnt_get_rtscts_rsvtime_le(priv, 3, |
---|
631 | | - tx_context->pkt_type, frame_len, current_rate); |
---|
632 | | - |
---|
633 | | - if (need_mic) |
---|
634 | | - head = &tx_head->tx_cts.tx.mic.head; |
---|
635 | | - |
---|
636 | | - /* Fill CTS */ |
---|
637 | | - if (tx_context->fb_option) |
---|
638 | | - return vnt_fill_cts_fb_head(tx_context, head); |
---|
639 | | - |
---|
640 | | - return vnt_fill_cts_head(tx_context, head); |
---|
641 | | -} |
---|
642 | | - |
---|
643 | | -static u16 vnt_rxtx_ab(struct vnt_usb_send_context *tx_context, |
---|
644 | | - union vnt_tx_head *tx_head, bool need_rts, bool need_mic) |
---|
645 | | -{ |
---|
646 | | - struct vnt_private *priv = tx_context->priv; |
---|
647 | | - struct vnt_rrv_time_ab *buf = &tx_head->tx_ab.ab; |
---|
648 | | - union vnt_tx_data_head *head = &tx_head->tx_ab.tx.head; |
---|
649 | | - u32 frame_len = tx_context->frame_len; |
---|
650 | | - u16 current_rate = tx_context->tx_rate; |
---|
651 | | - u8 need_ack = tx_context->need_ack; |
---|
652 | | - |
---|
653 | | - buf->rrv_time = vnt_rxtx_rsvtime_le16(priv, tx_context->pkt_type, |
---|
654 | | - frame_len, current_rate, need_ack); |
---|
655 | | - |
---|
656 | | - if (need_mic) |
---|
657 | | - head = &tx_head->tx_ab.tx.mic.head; |
---|
658 | | - |
---|
659 | | - if (need_rts) { |
---|
660 | | - if (tx_context->pkt_type == PK_TYPE_11B) |
---|
661 | | - buf->rts_rrv_time = vnt_get_rtscts_rsvtime_le(priv, 0, |
---|
662 | | - tx_context->pkt_type, frame_len, current_rate); |
---|
663 | | - else /* PK_TYPE_11A */ |
---|
664 | | - buf->rts_rrv_time = vnt_get_rtscts_rsvtime_le(priv, 2, |
---|
665 | | - tx_context->pkt_type, frame_len, current_rate); |
---|
666 | | - |
---|
667 | | - if (tx_context->fb_option && |
---|
668 | | - tx_context->pkt_type == PK_TYPE_11A) |
---|
669 | | - return vnt_rxtx_rts_a_fb_head(tx_context, |
---|
670 | | - &head->rts_a_fb); |
---|
671 | | - |
---|
672 | | - return vnt_rxtx_rts_ab_head(tx_context, &head->rts_ab); |
---|
673 | | - } |
---|
674 | | - |
---|
675 | | - if (tx_context->pkt_type == PK_TYPE_11A) |
---|
676 | | - return vnt_rxtx_datahead_a_fb(tx_context, |
---|
677 | | - &head->data_head_a_fb); |
---|
678 | | - |
---|
679 | | - return vnt_rxtx_datahead_ab(tx_context, &head->data_head_ab); |
---|
680 | | -} |
---|
681 | | - |
---|
682 | | -static u16 vnt_generate_tx_parameter(struct vnt_usb_send_context *tx_context, |
---|
683 | | - struct vnt_tx_buffer *tx_buffer, |
---|
684 | | - struct vnt_mic_hdr **mic_hdr, u32 need_mic, |
---|
685 | | - bool need_rts) |
---|
686 | | -{ |
---|
687 | | - if (tx_context->pkt_type == PK_TYPE_11GB || |
---|
688 | | - tx_context->pkt_type == PK_TYPE_11GA) { |
---|
689 | | - if (need_rts) { |
---|
690 | | - if (need_mic) |
---|
691 | | - *mic_hdr = |
---|
692 | | - &tx_buffer->tx_head.tx_rts.tx.mic.hdr; |
---|
693 | | - |
---|
694 | | - return vnt_rxtx_rts(tx_context, &tx_buffer->tx_head, |
---|
695 | | - need_mic); |
---|
696 | | - } |
---|
697 | | - |
---|
698 | | - if (need_mic) |
---|
699 | | - *mic_hdr = &tx_buffer->tx_head.tx_cts.tx.mic.hdr; |
---|
700 | | - |
---|
701 | | - return vnt_rxtx_cts(tx_context, &tx_buffer->tx_head, need_mic); |
---|
702 | | - } |
---|
703 | | - |
---|
704 | | - if (need_mic) |
---|
705 | | - *mic_hdr = &tx_buffer->tx_head.tx_ab.tx.mic.hdr; |
---|
706 | | - |
---|
707 | | - return vnt_rxtx_ab(tx_context, &tx_buffer->tx_head, need_rts, need_mic); |
---|
708 | | -} |
---|
709 | | - |
---|
710 | | -static void vnt_fill_txkey(struct vnt_usb_send_context *tx_context, |
---|
711 | | - u8 *key_buffer, struct ieee80211_key_conf *tx_key, |
---|
712 | | - struct sk_buff *skb, u16 payload_len, |
---|
713 | | - struct vnt_mic_hdr *mic_hdr) |
---|
714 | | -{ |
---|
715 | | - struct ieee80211_hdr *hdr = tx_context->hdr; |
---|
| 297 | + struct vnt_tx_fifo_head *fifo = &tx_buffer->fifo_head; |
---|
| 298 | + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
---|
| 299 | + struct ieee80211_key_conf *tx_key = info->control.hw_key; |
---|
| 300 | + struct vnt_mic_hdr *mic_hdr; |
---|
| 301 | + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
---|
716 | 302 | u64 pn64; |
---|
| 303 | + u16 payload_len = skb->len; |
---|
717 | 304 | u8 *iv = ((u8 *)hdr + ieee80211_get_hdrlen_from_skb(skb)); |
---|
718 | 305 | |
---|
719 | 306 | /* strip header and icv len from payload */ |
---|
.. | .. |
---|
723 | 310 | switch (tx_key->cipher) { |
---|
724 | 311 | case WLAN_CIPHER_SUITE_WEP40: |
---|
725 | 312 | case WLAN_CIPHER_SUITE_WEP104: |
---|
726 | | - memcpy(key_buffer, iv, 3); |
---|
727 | | - memcpy(key_buffer + 3, tx_key->key, tx_key->keylen); |
---|
| 313 | + memcpy(fifo->tx_key, iv, 3); |
---|
| 314 | + memcpy(fifo->tx_key + 3, tx_key->key, tx_key->keylen); |
---|
728 | 315 | |
---|
729 | 316 | if (tx_key->keylen == WLAN_KEY_LEN_WEP40) { |
---|
730 | | - memcpy(key_buffer + 8, iv, 3); |
---|
731 | | - memcpy(key_buffer + 11, |
---|
| 317 | + memcpy(fifo->tx_key + 8, iv, 3); |
---|
| 318 | + memcpy(fifo->tx_key + 11, |
---|
732 | 319 | tx_key->key, WLAN_KEY_LEN_WEP40); |
---|
733 | 320 | } |
---|
734 | 321 | |
---|
| 322 | + fifo->frag_ctl |= cpu_to_le16(FRAGCTL_LEGACY); |
---|
735 | 323 | break; |
---|
736 | 324 | case WLAN_CIPHER_SUITE_TKIP: |
---|
737 | | - ieee80211_get_tkip_p2k(tx_key, skb, key_buffer); |
---|
| 325 | + ieee80211_get_tkip_p2k(tx_key, skb, fifo->tx_key); |
---|
738 | 326 | |
---|
| 327 | + fifo->frag_ctl |= cpu_to_le16(FRAGCTL_TKIP); |
---|
739 | 328 | break; |
---|
740 | 329 | case WLAN_CIPHER_SUITE_CCMP: |
---|
741 | | - |
---|
742 | | - if (!mic_hdr) |
---|
743 | | - return; |
---|
| 330 | + if (info->control.use_cts_prot) { |
---|
| 331 | + if (info->control.use_rts) |
---|
| 332 | + mic_hdr = &tx_buffer->tx_head.tx_rts.tx.mic.hdr; |
---|
| 333 | + else |
---|
| 334 | + mic_hdr = &tx_buffer->tx_head.tx_cts.tx.mic.hdr; |
---|
| 335 | + } else { |
---|
| 336 | + mic_hdr = &tx_buffer->tx_head.tx_ab.tx.mic.hdr; |
---|
| 337 | + } |
---|
744 | 338 | |
---|
745 | 339 | mic_hdr->id = 0x59; |
---|
746 | 340 | mic_hdr->payload_len = cpu_to_be16(payload_len); |
---|
.. | .. |
---|
771 | 365 | if (ieee80211_has_a4(hdr->frame_control)) |
---|
772 | 366 | ether_addr_copy(mic_hdr->addr4, hdr->addr4); |
---|
773 | 367 | |
---|
774 | | - memcpy(key_buffer, tx_key->key, WLAN_KEY_LEN_CCMP); |
---|
| 368 | + memcpy(fifo->tx_key, tx_key->key, WLAN_KEY_LEN_CCMP); |
---|
775 | 369 | |
---|
776 | | - break; |
---|
| 370 | + fifo->frag_ctl |= cpu_to_le16(FRAGCTL_AES); |
---|
| 371 | + return true; |
---|
777 | 372 | default: |
---|
778 | 373 | break; |
---|
779 | 374 | } |
---|
| 375 | + |
---|
| 376 | + return false; |
---|
| 377 | +} |
---|
| 378 | + |
---|
| 379 | +static void vnt_rxtx_rts(struct vnt_usb_send_context *tx_context) |
---|
| 380 | +{ |
---|
| 381 | + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx_context->skb); |
---|
| 382 | + struct vnt_tx_buffer *tx_buffer = tx_context->tx_buffer; |
---|
| 383 | + union vnt_tx_head *tx_head = &tx_buffer->tx_head; |
---|
| 384 | + struct vnt_rrv_time_rts *buf = &tx_head->tx_rts.rts; |
---|
| 385 | + union vnt_tx_data_head *head = &tx_head->tx_rts.tx.head; |
---|
| 386 | + |
---|
| 387 | + buf->rts_rrv_time_aa = vnt_get_rts_duration(tx_context); |
---|
| 388 | + buf->rts_rrv_time_ba = buf->rts_rrv_time_aa; |
---|
| 389 | + buf->rts_rrv_time_bb = buf->rts_rrv_time_aa; |
---|
| 390 | + |
---|
| 391 | + buf->rrv_time_a = vnt_rxtx_rsvtime_le16(tx_context); |
---|
| 392 | + buf->rrv_time_b = buf->rrv_time_a; |
---|
| 393 | + |
---|
| 394 | + if (info->control.hw_key) { |
---|
| 395 | + if (vnt_fill_txkey(tx_buffer, tx_context->skb)) |
---|
| 396 | + head = &tx_head->tx_rts.tx.mic.head; |
---|
| 397 | + } |
---|
| 398 | + |
---|
| 399 | + vnt_rxtx_rts_g_head(tx_context, &head->rts_g); |
---|
| 400 | +} |
---|
| 401 | + |
---|
| 402 | +static void vnt_rxtx_cts(struct vnt_usb_send_context *tx_context) |
---|
| 403 | +{ |
---|
| 404 | + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx_context->skb); |
---|
| 405 | + struct vnt_tx_buffer *tx_buffer = tx_context->tx_buffer; |
---|
| 406 | + union vnt_tx_head *tx_head = &tx_buffer->tx_head; |
---|
| 407 | + struct vnt_rrv_time_cts *buf = &tx_head->tx_cts.cts; |
---|
| 408 | + union vnt_tx_data_head *head = &tx_head->tx_cts.tx.head; |
---|
| 409 | + |
---|
| 410 | + buf->rrv_time_a = vnt_rxtx_rsvtime_le16(tx_context); |
---|
| 411 | + buf->rrv_time_b = buf->rrv_time_a; |
---|
| 412 | + |
---|
| 413 | + buf->cts_rrv_time_ba = vnt_get_cts_duration(tx_context); |
---|
| 414 | + |
---|
| 415 | + if (info->control.hw_key) { |
---|
| 416 | + if (vnt_fill_txkey(tx_buffer, tx_context->skb)) |
---|
| 417 | + head = &tx_head->tx_cts.tx.mic.head; |
---|
| 418 | + } |
---|
| 419 | + |
---|
| 420 | + vnt_fill_cts_head(tx_context, head); |
---|
| 421 | +} |
---|
| 422 | + |
---|
| 423 | +static void vnt_rxtx_ab(struct vnt_usb_send_context *tx_context) |
---|
| 424 | +{ |
---|
| 425 | + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx_context->skb); |
---|
| 426 | + struct vnt_tx_buffer *tx_buffer = tx_context->tx_buffer; |
---|
| 427 | + union vnt_tx_head *tx_head = &tx_buffer->tx_head; |
---|
| 428 | + struct vnt_rrv_time_ab *buf = &tx_head->tx_ab.ab; |
---|
| 429 | + union vnt_tx_data_head *head = &tx_head->tx_ab.tx.head; |
---|
| 430 | + |
---|
| 431 | + buf->rrv_time = vnt_rxtx_rsvtime_le16(tx_context); |
---|
| 432 | + |
---|
| 433 | + if (info->control.hw_key) { |
---|
| 434 | + if (vnt_fill_txkey(tx_buffer, tx_context->skb)) |
---|
| 435 | + head = &tx_head->tx_ab.tx.mic.head; |
---|
| 436 | + } |
---|
| 437 | + |
---|
| 438 | + if (info->control.use_rts) { |
---|
| 439 | + buf->rts_rrv_time = vnt_get_rts_duration(tx_context); |
---|
| 440 | + |
---|
| 441 | + vnt_rxtx_rts_ab_head(tx_context, &head->rts_ab); |
---|
| 442 | + |
---|
| 443 | + return; |
---|
| 444 | + } |
---|
| 445 | + |
---|
| 446 | + vnt_rxtx_datahead_ab(tx_context, &head->data_head_ab); |
---|
| 447 | +} |
---|
| 448 | + |
---|
| 449 | +static void vnt_generate_tx_parameter(struct vnt_usb_send_context *tx_context) |
---|
| 450 | +{ |
---|
| 451 | + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx_context->skb); |
---|
| 452 | + |
---|
| 453 | + if (info->control.use_cts_prot) { |
---|
| 454 | + if (info->control.use_rts) { |
---|
| 455 | + vnt_rxtx_rts(tx_context); |
---|
| 456 | + |
---|
| 457 | + return; |
---|
| 458 | + } |
---|
| 459 | + |
---|
| 460 | + vnt_rxtx_cts(tx_context); |
---|
| 461 | + |
---|
| 462 | + return; |
---|
| 463 | + } |
---|
| 464 | + |
---|
| 465 | + vnt_rxtx_ab(tx_context); |
---|
| 466 | +} |
---|
| 467 | + |
---|
| 468 | +static u16 vnt_get_hdr_size(struct ieee80211_tx_info *info) |
---|
| 469 | +{ |
---|
| 470 | + u16 size = sizeof(struct vnt_tx_datahead_ab); |
---|
| 471 | + |
---|
| 472 | + if (info->control.use_cts_prot) { |
---|
| 473 | + if (info->control.use_rts) |
---|
| 474 | + size = sizeof(struct vnt_rts_g); |
---|
| 475 | + else |
---|
| 476 | + size = sizeof(struct vnt_cts); |
---|
| 477 | + } else if (info->control.use_rts) { |
---|
| 478 | + size = sizeof(struct vnt_rts_ab); |
---|
| 479 | + } |
---|
| 480 | + |
---|
| 481 | + if (info->control.hw_key) { |
---|
| 482 | + if (info->control.hw_key->cipher == WLAN_CIPHER_SUITE_CCMP) |
---|
| 483 | + size += sizeof(struct vnt_mic_hdr); |
---|
| 484 | + } |
---|
| 485 | + |
---|
| 486 | + /* Get rrv_time header */ |
---|
| 487 | + if (info->control.use_cts_prot) { |
---|
| 488 | + if (info->control.use_rts) |
---|
| 489 | + size += sizeof(struct vnt_rrv_time_rts); |
---|
| 490 | + else |
---|
| 491 | + size += sizeof(struct vnt_rrv_time_cts); |
---|
| 492 | + } else { |
---|
| 493 | + size += sizeof(struct vnt_rrv_time_ab); |
---|
| 494 | + } |
---|
| 495 | + |
---|
| 496 | + size += sizeof(struct vnt_tx_fifo_head); |
---|
| 497 | + |
---|
| 498 | + return size; |
---|
780 | 499 | } |
---|
781 | 500 | |
---|
782 | 501 | int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb) |
---|
.. | .. |
---|
784 | 503 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
---|
785 | 504 | struct ieee80211_tx_rate *tx_rate = &info->control.rates[0]; |
---|
786 | 505 | struct ieee80211_rate *rate; |
---|
787 | | - struct ieee80211_key_conf *tx_key; |
---|
788 | 506 | struct ieee80211_hdr *hdr; |
---|
789 | | - struct vnt_mic_hdr *mic_hdr = NULL; |
---|
790 | 507 | struct vnt_tx_buffer *tx_buffer; |
---|
791 | 508 | struct vnt_tx_fifo_head *tx_buffer_head; |
---|
792 | 509 | struct vnt_usb_send_context *tx_context; |
---|
793 | 510 | unsigned long flags; |
---|
794 | | - u16 tx_bytes, tx_header_size, tx_body_size, current_rate, duration_id; |
---|
795 | | - u8 pkt_type, fb_option = AUTO_FB_NONE; |
---|
796 | | - bool need_rts = false; |
---|
797 | | - bool need_mic = false; |
---|
| 511 | + u8 pkt_type; |
---|
798 | 512 | |
---|
799 | 513 | hdr = (struct ieee80211_hdr *)(skb->data); |
---|
800 | 514 | |
---|
801 | 515 | rate = ieee80211_get_tx_rate(priv->hw, info); |
---|
802 | 516 | |
---|
803 | | - current_rate = rate->hw_value; |
---|
804 | | - if (priv->current_rate != current_rate && |
---|
805 | | - !(priv->hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)) { |
---|
806 | | - priv->current_rate = current_rate; |
---|
807 | | - vnt_schedule_command(priv, WLAN_CMD_SETPOWER); |
---|
808 | | - } |
---|
809 | | - |
---|
810 | | - if (current_rate > RATE_11M) { |
---|
| 517 | + if (rate->hw_value > RATE_11M) { |
---|
811 | 518 | if (info->band == NL80211_BAND_5GHZ) { |
---|
812 | 519 | pkt_type = PK_TYPE_11A; |
---|
813 | 520 | } else { |
---|
.. | .. |
---|
833 | 540 | return -ENOMEM; |
---|
834 | 541 | } |
---|
835 | 542 | |
---|
836 | | - tx_context->skb = skb; |
---|
837 | 543 | tx_context->pkt_type = pkt_type; |
---|
838 | | - tx_context->need_ack = false; |
---|
839 | 544 | tx_context->frame_len = skb->len + 4; |
---|
840 | | - tx_context->tx_rate = current_rate; |
---|
| 545 | + tx_context->tx_rate = rate->hw_value; |
---|
841 | 546 | |
---|
842 | 547 | spin_unlock_irqrestore(&priv->lock, flags); |
---|
843 | 548 | |
---|
844 | | - tx_buffer = (struct vnt_tx_buffer *)tx_context->data; |
---|
| 549 | + tx_context->skb = skb_clone(skb, GFP_ATOMIC); |
---|
| 550 | + if (!tx_context->skb) { |
---|
| 551 | + tx_context->in_use = false; |
---|
| 552 | + return -ENOMEM; |
---|
| 553 | + } |
---|
| 554 | + |
---|
| 555 | + tx_buffer = skb_push(skb, vnt_get_hdr_size(info)); |
---|
| 556 | + tx_context->tx_buffer = tx_buffer; |
---|
845 | 557 | tx_buffer_head = &tx_buffer->fifo_head; |
---|
846 | | - tx_body_size = skb->len; |
---|
| 558 | + |
---|
| 559 | + tx_context->type = CONTEXT_DATA_PACKET; |
---|
847 | 560 | |
---|
848 | 561 | /*Set fifo controls */ |
---|
849 | 562 | if (pkt_type == PK_TYPE_11A) |
---|
.. | .. |
---|
867 | 580 | cpu_to_le16(DEFAULT_MSDU_LIFETIME_RES_64us); |
---|
868 | 581 | } |
---|
869 | 582 | |
---|
870 | | - if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) { |
---|
| 583 | + if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) |
---|
871 | 584 | tx_buffer_head->fifo_ctl |= cpu_to_le16(FIFOCTL_NEEDACK); |
---|
872 | | - tx_context->need_ack = true; |
---|
873 | | - } |
---|
874 | 585 | |
---|
875 | 586 | if (ieee80211_has_retry(hdr->frame_control)) |
---|
876 | 587 | tx_buffer_head->fifo_ctl |= cpu_to_le16(FIFOCTL_LRETRY); |
---|
877 | 588 | |
---|
878 | | - if (tx_rate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) |
---|
879 | | - priv->preamble_type = PREAMBLE_SHORT; |
---|
880 | | - else |
---|
881 | | - priv->preamble_type = PREAMBLE_LONG; |
---|
882 | | - |
---|
883 | | - if (tx_rate->flags & IEEE80211_TX_RC_USE_RTS_CTS) { |
---|
884 | | - need_rts = true; |
---|
| 589 | + if (info->control.use_rts) |
---|
885 | 590 | tx_buffer_head->fifo_ctl |= cpu_to_le16(FIFOCTL_RTS); |
---|
886 | | - } |
---|
887 | 591 | |
---|
888 | 592 | if (ieee80211_has_a4(hdr->frame_control)) |
---|
889 | 593 | tx_buffer_head->fifo_ctl |= cpu_to_le16(FIFOCTL_LHEAD); |
---|
890 | 594 | |
---|
891 | 595 | tx_buffer_head->frag_ctl = |
---|
892 | | - cpu_to_le16(ieee80211_get_hdrlen_from_skb(skb) << 10); |
---|
| 596 | + cpu_to_le16(ieee80211_hdrlen(hdr->frame_control) << 10); |
---|
893 | 597 | |
---|
894 | | - if (info->control.hw_key) { |
---|
895 | | - tx_key = info->control.hw_key; |
---|
896 | | - switch (info->control.hw_key->cipher) { |
---|
897 | | - case WLAN_CIPHER_SUITE_WEP40: |
---|
898 | | - case WLAN_CIPHER_SUITE_WEP104: |
---|
899 | | - tx_buffer_head->frag_ctl |= cpu_to_le16(FRAGCTL_LEGACY); |
---|
900 | | - break; |
---|
901 | | - case WLAN_CIPHER_SUITE_TKIP: |
---|
902 | | - tx_buffer_head->frag_ctl |= cpu_to_le16(FRAGCTL_TKIP); |
---|
903 | | - break; |
---|
904 | | - case WLAN_CIPHER_SUITE_CCMP: |
---|
905 | | - tx_buffer_head->frag_ctl |= cpu_to_le16(FRAGCTL_AES); |
---|
906 | | - need_mic = true; |
---|
907 | | - default: |
---|
908 | | - break; |
---|
909 | | - } |
---|
910 | | - tx_context->frame_len += tx_key->icv_len; |
---|
911 | | - } |
---|
| 598 | + if (info->control.hw_key) |
---|
| 599 | + tx_context->frame_len += info->control.hw_key->icv_len; |
---|
912 | 600 | |
---|
913 | | - tx_buffer_head->current_rate = cpu_to_le16(current_rate); |
---|
| 601 | + tx_buffer_head->current_rate = cpu_to_le16(rate->hw_value); |
---|
914 | 602 | |
---|
915 | | - /* legacy rates TODO use ieee80211_tx_rate */ |
---|
916 | | - if (current_rate >= RATE_18M && ieee80211_is_data(hdr->frame_control)) { |
---|
917 | | - if (priv->auto_fb_ctrl == AUTO_FB_0) { |
---|
918 | | - tx_buffer_head->fifo_ctl |= |
---|
919 | | - cpu_to_le16(FIFOCTL_AUTO_FB_0); |
---|
920 | | - |
---|
921 | | - priv->tx_rate_fb0 = |
---|
922 | | - vnt_fb_opt0[FB_RATE0][current_rate - RATE_18M]; |
---|
923 | | - priv->tx_rate_fb1 = |
---|
924 | | - vnt_fb_opt0[FB_RATE1][current_rate - RATE_18M]; |
---|
925 | | - |
---|
926 | | - fb_option = AUTO_FB_0; |
---|
927 | | - } else if (priv->auto_fb_ctrl == AUTO_FB_1) { |
---|
928 | | - tx_buffer_head->fifo_ctl |= |
---|
929 | | - cpu_to_le16(FIFOCTL_AUTO_FB_1); |
---|
930 | | - |
---|
931 | | - priv->tx_rate_fb0 = |
---|
932 | | - vnt_fb_opt1[FB_RATE0][current_rate - RATE_18M]; |
---|
933 | | - priv->tx_rate_fb1 = |
---|
934 | | - vnt_fb_opt1[FB_RATE1][current_rate - RATE_18M]; |
---|
935 | | - |
---|
936 | | - fb_option = AUTO_FB_1; |
---|
937 | | - } |
---|
938 | | - } |
---|
939 | | - |
---|
940 | | - tx_context->fb_option = fb_option; |
---|
941 | | - |
---|
942 | | - duration_id = vnt_generate_tx_parameter(tx_context, tx_buffer, &mic_hdr, |
---|
943 | | - need_mic, need_rts); |
---|
944 | | - |
---|
945 | | - tx_header_size = tx_context->tx_hdr_size; |
---|
946 | | - if (!tx_header_size) { |
---|
947 | | - tx_context->in_use = false; |
---|
948 | | - return -ENOMEM; |
---|
949 | | - } |
---|
| 603 | + vnt_generate_tx_parameter(tx_context); |
---|
950 | 604 | |
---|
951 | 605 | tx_buffer_head->frag_ctl |= cpu_to_le16(FRAGCTL_NONFRAG); |
---|
952 | | - |
---|
953 | | - tx_bytes = tx_header_size + tx_body_size; |
---|
954 | | - |
---|
955 | | - memcpy(tx_context->hdr, skb->data, tx_body_size); |
---|
956 | | - |
---|
957 | | - hdr->duration_id = cpu_to_le16(duration_id); |
---|
958 | | - |
---|
959 | | - if (info->control.hw_key) { |
---|
960 | | - tx_key = info->control.hw_key; |
---|
961 | | - if (tx_key->keylen > 0) |
---|
962 | | - vnt_fill_txkey(tx_context, tx_buffer_head->tx_key, |
---|
963 | | - tx_key, skb, tx_body_size, mic_hdr); |
---|
964 | | - } |
---|
965 | 606 | |
---|
966 | 607 | priv->seq_counter = (le16_to_cpu(hdr->seq_ctrl) & |
---|
967 | 608 | IEEE80211_SCTL_SEQ) >> 4; |
---|
968 | 609 | |
---|
969 | | - tx_buffer->tx_byte_count = cpu_to_le16(tx_bytes); |
---|
970 | | - tx_buffer->pkt_no = tx_context->pkt_no; |
---|
971 | | - tx_buffer->type = 0x00; |
---|
972 | | - |
---|
973 | | - tx_bytes += 4; |
---|
974 | | - |
---|
975 | | - tx_context->type = CONTEXT_DATA_PACKET; |
---|
976 | | - tx_context->buf_len = tx_bytes; |
---|
977 | | - |
---|
978 | 610 | spin_lock_irqsave(&priv->lock, flags); |
---|
979 | 611 | |
---|
980 | | - if (vnt_tx_context(priv, tx_context) != STATUS_PENDING) { |
---|
| 612 | + if (vnt_tx_context(priv, tx_context, skb)) { |
---|
| 613 | + dev_kfree_skb(tx_context->skb); |
---|
981 | 614 | spin_unlock_irqrestore(&priv->lock, flags); |
---|
982 | 615 | return -EIO; |
---|
983 | 616 | } |
---|
| 617 | + |
---|
| 618 | + dev_kfree_skb(skb); |
---|
984 | 619 | |
---|
985 | 620 | spin_unlock_irqrestore(&priv->lock, flags); |
---|
986 | 621 | |
---|
.. | .. |
---|
989 | 624 | |
---|
990 | 625 | static int vnt_beacon_xmit(struct vnt_private *priv, struct sk_buff *skb) |
---|
991 | 626 | { |
---|
992 | | - struct vnt_beacon_buffer *beacon_buffer; |
---|
993 | 627 | struct vnt_tx_short_buf_head *short_head; |
---|
994 | 628 | struct ieee80211_tx_info *info; |
---|
995 | 629 | struct vnt_usb_send_context *context; |
---|
996 | 630 | struct ieee80211_mgmt *mgmt_hdr; |
---|
997 | 631 | unsigned long flags; |
---|
998 | 632 | u32 frame_size = skb->len + 4; |
---|
999 | | - u16 current_rate, count; |
---|
| 633 | + u16 current_rate; |
---|
1000 | 634 | |
---|
1001 | 635 | spin_lock_irqsave(&priv->lock, flags); |
---|
1002 | 636 | |
---|
.. | .. |
---|
1011 | 645 | |
---|
1012 | 646 | spin_unlock_irqrestore(&priv->lock, flags); |
---|
1013 | 647 | |
---|
1014 | | - beacon_buffer = (struct vnt_beacon_buffer *)&context->data[0]; |
---|
1015 | | - short_head = &beacon_buffer->short_head; |
---|
| 648 | + mgmt_hdr = (struct ieee80211_mgmt *)skb->data; |
---|
| 649 | + short_head = skb_push(skb, sizeof(*short_head)); |
---|
1016 | 650 | |
---|
1017 | 651 | if (priv->bb_type == BB_TYPE_11A) { |
---|
1018 | 652 | current_rate = RATE_6M; |
---|
.. | .. |
---|
1021 | 655 | vnt_get_phy_field(priv, frame_size, current_rate, |
---|
1022 | 656 | PK_TYPE_11A, &short_head->ab); |
---|
1023 | 657 | |
---|
1024 | | - /* Get Duration and TimeStampOff */ |
---|
1025 | | - short_head->duration = vnt_get_duration_le(priv, |
---|
1026 | | - PK_TYPE_11A, false); |
---|
| 658 | + /* Get TimeStampOff */ |
---|
1027 | 659 | short_head->time_stamp_off = |
---|
1028 | 660 | vnt_time_stamp_off(priv, current_rate); |
---|
1029 | 661 | } else { |
---|
.. | .. |
---|
1034 | 666 | vnt_get_phy_field(priv, frame_size, current_rate, |
---|
1035 | 667 | PK_TYPE_11B, &short_head->ab); |
---|
1036 | 668 | |
---|
1037 | | - /* Get Duration and TimeStampOff */ |
---|
1038 | | - short_head->duration = vnt_get_duration_le(priv, |
---|
1039 | | - PK_TYPE_11B, false); |
---|
| 669 | + /* Get TimeStampOff */ |
---|
1040 | 670 | short_head->time_stamp_off = |
---|
1041 | 671 | vnt_time_stamp_off(priv, current_rate); |
---|
1042 | 672 | } |
---|
1043 | 673 | |
---|
1044 | | - /* Generate Beacon Header */ |
---|
1045 | | - mgmt_hdr = &beacon_buffer->mgmt_hdr; |
---|
1046 | | - memcpy(mgmt_hdr, skb->data, skb->len); |
---|
| 674 | + /* Get Duration */ |
---|
| 675 | + short_head->duration = mgmt_hdr->duration; |
---|
1047 | 676 | |
---|
1048 | 677 | /* time stamp always 0 */ |
---|
1049 | 678 | mgmt_hdr->u.beacon.timestamp = 0; |
---|
.. | .. |
---|
1060 | 689 | if (priv->seq_counter > 0x0fff) |
---|
1061 | 690 | priv->seq_counter = 0; |
---|
1062 | 691 | |
---|
1063 | | - count = sizeof(struct vnt_tx_short_buf_head) + skb->len; |
---|
1064 | | - |
---|
1065 | | - beacon_buffer->tx_byte_count = cpu_to_le16(count); |
---|
1066 | | - beacon_buffer->pkt_no = context->pkt_no; |
---|
1067 | | - beacon_buffer->type = 0x01; |
---|
1068 | | - |
---|
1069 | 692 | context->type = CONTEXT_BEACON_PACKET; |
---|
1070 | | - context->buf_len = count + 4; /* USB header */ |
---|
1071 | 693 | |
---|
1072 | 694 | spin_lock_irqsave(&priv->lock, flags); |
---|
1073 | 695 | |
---|
1074 | | - if (vnt_tx_context(priv, context) != STATUS_PENDING) |
---|
| 696 | + if (vnt_tx_context(priv, context, skb)) |
---|
1075 | 697 | ieee80211_free_txskb(priv->hw, context->skb); |
---|
1076 | 698 | |
---|
1077 | 699 | spin_unlock_irqrestore(&priv->lock, flags); |
---|