diff options
Diffstat (limited to 'net/mac80211/tx.c')
-rw-r--r-- | net/mac80211/tx.c | 732 |
1 files changed, 433 insertions, 299 deletions
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 67b509edd431..f35eaea98e73 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -25,11 +25,12 @@ | |||
25 | #include <asm/unaligned.h> | 25 | #include <asm/unaligned.h> |
26 | 26 | ||
27 | #include "ieee80211_i.h" | 27 | #include "ieee80211_i.h" |
28 | #include "ieee80211_led.h" | 28 | #include "led.h" |
29 | #include "mesh.h" | ||
29 | #include "wep.h" | 30 | #include "wep.h" |
30 | #include "wpa.h" | 31 | #include "wpa.h" |
31 | #include "wme.h" | 32 | #include "wme.h" |
32 | #include "ieee80211_rate.h" | 33 | #include "rate.h" |
33 | 34 | ||
34 | #define IEEE80211_TX_OK 0 | 35 | #define IEEE80211_TX_OK 0 |
35 | #define IEEE80211_TX_AGAIN 1 | 36 | #define IEEE80211_TX_AGAIN 1 |
@@ -86,15 +87,19 @@ static inline void ieee80211_dump_frame(const char *ifname, const char *title, | |||
86 | } | 87 | } |
87 | #endif /* CONFIG_MAC80211_LOWTX_FRAME_DUMP */ | 88 | #endif /* CONFIG_MAC80211_LOWTX_FRAME_DUMP */ |
88 | 89 | ||
89 | static u16 ieee80211_duration(struct ieee80211_txrx_data *tx, int group_addr, | 90 | static u16 ieee80211_duration(struct ieee80211_tx_data *tx, int group_addr, |
90 | int next_frag_len) | 91 | int next_frag_len) |
91 | { | 92 | { |
92 | int rate, mrate, erp, dur, i; | 93 | int rate, mrate, erp, dur, i; |
93 | struct ieee80211_rate *txrate = tx->u.tx.rate; | 94 | struct ieee80211_rate *txrate = tx->rate; |
94 | struct ieee80211_local *local = tx->local; | 95 | struct ieee80211_local *local = tx->local; |
95 | struct ieee80211_hw_mode *mode = tx->u.tx.mode; | 96 | struct ieee80211_supported_band *sband; |
96 | 97 | ||
97 | erp = txrate->flags & IEEE80211_RATE_ERP; | 98 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; |
99 | |||
100 | erp = 0; | ||
101 | if (tx->sdata->flags & IEEE80211_SDATA_OPERATING_GMODE) | ||
102 | erp = txrate->flags & IEEE80211_RATE_ERP_G; | ||
98 | 103 | ||
99 | /* | 104 | /* |
100 | * data and mgmt (except PS Poll): | 105 | * data and mgmt (except PS Poll): |
@@ -150,20 +155,36 @@ static u16 ieee80211_duration(struct ieee80211_txrx_data *tx, int group_addr, | |||
150 | * Mandatory rates for IEEE 802.11g PHY: 1, 2, 5.5, 11, 6, 12, 24 Mbps | 155 | * Mandatory rates for IEEE 802.11g PHY: 1, 2, 5.5, 11, 6, 12, 24 Mbps |
151 | */ | 156 | */ |
152 | rate = -1; | 157 | rate = -1; |
153 | mrate = 10; /* use 1 Mbps if everything fails */ | 158 | /* use lowest available if everything fails */ |
154 | for (i = 0; i < mode->num_rates; i++) { | 159 | mrate = sband->bitrates[0].bitrate; |
155 | struct ieee80211_rate *r = &mode->rates[i]; | 160 | for (i = 0; i < sband->n_bitrates; i++) { |
156 | if (r->rate > txrate->rate) | 161 | struct ieee80211_rate *r = &sband->bitrates[i]; |
157 | break; | ||
158 | 162 | ||
159 | if (IEEE80211_RATE_MODULATION(txrate->flags) != | 163 | if (r->bitrate > txrate->bitrate) |
160 | IEEE80211_RATE_MODULATION(r->flags)) | 164 | break; |
161 | continue; | ||
162 | 165 | ||
163 | if (r->flags & IEEE80211_RATE_BASIC) | 166 | if (tx->sdata->basic_rates & BIT(i)) |
164 | rate = r->rate; | 167 | rate = r->bitrate; |
165 | else if (r->flags & IEEE80211_RATE_MANDATORY) | 168 | |
166 | mrate = r->rate; | 169 | switch (sband->band) { |
170 | case IEEE80211_BAND_2GHZ: { | ||
171 | u32 flag; | ||
172 | if (tx->sdata->flags & IEEE80211_SDATA_OPERATING_GMODE) | ||
173 | flag = IEEE80211_RATE_MANDATORY_G; | ||
174 | else | ||
175 | flag = IEEE80211_RATE_MANDATORY_B; | ||
176 | if (r->flags & flag) | ||
177 | mrate = r->bitrate; | ||
178 | break; | ||
179 | } | ||
180 | case IEEE80211_BAND_5GHZ: | ||
181 | if (r->flags & IEEE80211_RATE_MANDATORY_A) | ||
182 | mrate = r->bitrate; | ||
183 | break; | ||
184 | case IEEE80211_NUM_BANDS: | ||
185 | WARN_ON(1); | ||
186 | break; | ||
187 | } | ||
167 | } | 188 | } |
168 | if (rate == -1) { | 189 | if (rate == -1) { |
169 | /* No matching basic rate found; use highest suitable mandatory | 190 | /* No matching basic rate found; use highest suitable mandatory |
@@ -184,7 +205,7 @@ static u16 ieee80211_duration(struct ieee80211_txrx_data *tx, int group_addr, | |||
184 | dur *= 2; /* ACK + SIFS */ | 205 | dur *= 2; /* ACK + SIFS */ |
185 | /* next fragment */ | 206 | /* next fragment */ |
186 | dur += ieee80211_frame_duration(local, next_frag_len, | 207 | dur += ieee80211_frame_duration(local, next_frag_len, |
187 | txrate->rate, erp, | 208 | txrate->bitrate, erp, |
188 | tx->sdata->bss_conf.use_short_preamble); | 209 | tx->sdata->bss_conf.use_short_preamble); |
189 | } | 210 | } |
190 | 211 | ||
@@ -212,8 +233,8 @@ static int inline is_ieee80211_device(struct net_device *dev, | |||
212 | 233 | ||
213 | /* tx handlers */ | 234 | /* tx handlers */ |
214 | 235 | ||
215 | static ieee80211_txrx_result | 236 | static ieee80211_tx_result |
216 | ieee80211_tx_h_check_assoc(struct ieee80211_txrx_data *tx) | 237 | ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx) |
217 | { | 238 | { |
218 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 239 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
219 | struct sk_buff *skb = tx->skb; | 240 | struct sk_buff *skb = tx->skb; |
@@ -221,20 +242,23 @@ ieee80211_tx_h_check_assoc(struct ieee80211_txrx_data *tx) | |||
221 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ | 242 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ |
222 | u32 sta_flags; | 243 | u32 sta_flags; |
223 | 244 | ||
224 | if (unlikely(tx->flags & IEEE80211_TXRXD_TX_INJECTED)) | 245 | if (unlikely(tx->flags & IEEE80211_TX_INJECTED)) |
225 | return TXRX_CONTINUE; | 246 | return TX_CONTINUE; |
226 | 247 | ||
227 | if (unlikely(tx->local->sta_sw_scanning) && | 248 | if (unlikely(tx->local->sta_sw_scanning) && |
228 | ((tx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_MGMT || | 249 | ((tx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_MGMT || |
229 | (tx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_PROBE_REQ)) | 250 | (tx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_PROBE_REQ)) |
230 | return TXRX_DROP; | 251 | return TX_DROP; |
231 | 252 | ||
232 | if (tx->flags & IEEE80211_TXRXD_TXPS_BUFFERED) | 253 | if (tx->sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT) |
233 | return TXRX_CONTINUE; | 254 | return TX_CONTINUE; |
255 | |||
256 | if (tx->flags & IEEE80211_TX_PS_BUFFERED) | ||
257 | return TX_CONTINUE; | ||
234 | 258 | ||
235 | sta_flags = tx->sta ? tx->sta->flags : 0; | 259 | sta_flags = tx->sta ? tx->sta->flags : 0; |
236 | 260 | ||
237 | if (likely(tx->flags & IEEE80211_TXRXD_TXUNICAST)) { | 261 | if (likely(tx->flags & IEEE80211_TX_UNICAST)) { |
238 | if (unlikely(!(sta_flags & WLAN_STA_ASSOC) && | 262 | if (unlikely(!(sta_flags & WLAN_STA_ASSOC) && |
239 | tx->sdata->vif.type != IEEE80211_IF_TYPE_IBSS && | 263 | tx->sdata->vif.type != IEEE80211_IF_TYPE_IBSS && |
240 | (tx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)) { | 264 | (tx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)) { |
@@ -245,7 +269,7 @@ ieee80211_tx_h_check_assoc(struct ieee80211_txrx_data *tx) | |||
245 | tx->dev->name, print_mac(mac, hdr->addr1)); | 269 | tx->dev->name, print_mac(mac, hdr->addr1)); |
246 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ | 270 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ |
247 | I802_DEBUG_INC(tx->local->tx_handlers_drop_not_assoc); | 271 | I802_DEBUG_INC(tx->local->tx_handlers_drop_not_assoc); |
248 | return TXRX_DROP; | 272 | return TX_DROP; |
249 | } | 273 | } |
250 | } else { | 274 | } else { |
251 | if (unlikely((tx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA && | 275 | if (unlikely((tx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA && |
@@ -255,23 +279,23 @@ ieee80211_tx_h_check_assoc(struct ieee80211_txrx_data *tx) | |||
255 | * No associated STAs - no need to send multicast | 279 | * No associated STAs - no need to send multicast |
256 | * frames. | 280 | * frames. |
257 | */ | 281 | */ |
258 | return TXRX_DROP; | 282 | return TX_DROP; |
259 | } | 283 | } |
260 | return TXRX_CONTINUE; | 284 | return TX_CONTINUE; |
261 | } | 285 | } |
262 | 286 | ||
263 | return TXRX_CONTINUE; | 287 | return TX_CONTINUE; |
264 | } | 288 | } |
265 | 289 | ||
266 | static ieee80211_txrx_result | 290 | static ieee80211_tx_result |
267 | ieee80211_tx_h_sequence(struct ieee80211_txrx_data *tx) | 291 | ieee80211_tx_h_sequence(struct ieee80211_tx_data *tx) |
268 | { | 292 | { |
269 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; | 293 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; |
270 | 294 | ||
271 | if (ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_control)) >= 24) | 295 | if (ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_control)) >= 24) |
272 | ieee80211_include_sequence(tx->sdata, hdr); | 296 | ieee80211_include_sequence(tx->sdata, hdr); |
273 | 297 | ||
274 | return TXRX_CONTINUE; | 298 | return TX_CONTINUE; |
275 | } | 299 | } |
276 | 300 | ||
277 | /* This function is called whenever the AP is about to exceed the maximum limit | 301 | /* This function is called whenever the AP is about to exceed the maximum limit |
@@ -303,10 +327,8 @@ static void purge_old_ps_buffers(struct ieee80211_local *local) | |||
303 | } | 327 | } |
304 | total += skb_queue_len(&ap->ps_bc_buf); | 328 | total += skb_queue_len(&ap->ps_bc_buf); |
305 | } | 329 | } |
306 | rcu_read_unlock(); | ||
307 | 330 | ||
308 | read_lock_bh(&local->sta_lock); | 331 | list_for_each_entry_rcu(sta, &local->sta_list, list) { |
309 | list_for_each_entry(sta, &local->sta_list, list) { | ||
310 | skb = skb_dequeue(&sta->ps_tx_buf); | 332 | skb = skb_dequeue(&sta->ps_tx_buf); |
311 | if (skb) { | 333 | if (skb) { |
312 | purged++; | 334 | purged++; |
@@ -314,15 +336,16 @@ static void purge_old_ps_buffers(struct ieee80211_local *local) | |||
314 | } | 336 | } |
315 | total += skb_queue_len(&sta->ps_tx_buf); | 337 | total += skb_queue_len(&sta->ps_tx_buf); |
316 | } | 338 | } |
317 | read_unlock_bh(&local->sta_lock); | 339 | |
340 | rcu_read_unlock(); | ||
318 | 341 | ||
319 | local->total_ps_buffered = total; | 342 | local->total_ps_buffered = total; |
320 | printk(KERN_DEBUG "%s: PS buffers full - purged %d frames\n", | 343 | printk(KERN_DEBUG "%s: PS buffers full - purged %d frames\n", |
321 | wiphy_name(local->hw.wiphy), purged); | 344 | wiphy_name(local->hw.wiphy), purged); |
322 | } | 345 | } |
323 | 346 | ||
324 | static ieee80211_txrx_result | 347 | static ieee80211_tx_result |
325 | ieee80211_tx_h_multicast_ps_buf(struct ieee80211_txrx_data *tx) | 348 | ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx) |
326 | { | 349 | { |
327 | /* | 350 | /* |
328 | * broadcast/multicast frame | 351 | * broadcast/multicast frame |
@@ -334,11 +357,11 @@ ieee80211_tx_h_multicast_ps_buf(struct ieee80211_txrx_data *tx) | |||
334 | 357 | ||
335 | /* not AP/IBSS or ordered frame */ | 358 | /* not AP/IBSS or ordered frame */ |
336 | if (!tx->sdata->bss || (tx->fc & IEEE80211_FCTL_ORDER)) | 359 | if (!tx->sdata->bss || (tx->fc & IEEE80211_FCTL_ORDER)) |
337 | return TXRX_CONTINUE; | 360 | return TX_CONTINUE; |
338 | 361 | ||
339 | /* no stations in PS mode */ | 362 | /* no stations in PS mode */ |
340 | if (!atomic_read(&tx->sdata->bss->num_sta_ps)) | 363 | if (!atomic_read(&tx->sdata->bss->num_sta_ps)) |
341 | return TXRX_CONTINUE; | 364 | return TX_CONTINUE; |
342 | 365 | ||
343 | /* buffered in mac80211 */ | 366 | /* buffered in mac80211 */ |
344 | if (tx->local->hw.flags & IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING) { | 367 | if (tx->local->hw.flags & IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING) { |
@@ -355,17 +378,17 @@ ieee80211_tx_h_multicast_ps_buf(struct ieee80211_txrx_data *tx) | |||
355 | } else | 378 | } else |
356 | tx->local->total_ps_buffered++; | 379 | tx->local->total_ps_buffered++; |
357 | skb_queue_tail(&tx->sdata->bss->ps_bc_buf, tx->skb); | 380 | skb_queue_tail(&tx->sdata->bss->ps_bc_buf, tx->skb); |
358 | return TXRX_QUEUED; | 381 | return TX_QUEUED; |
359 | } | 382 | } |
360 | 383 | ||
361 | /* buffered in hardware */ | 384 | /* buffered in hardware */ |
362 | tx->u.tx.control->flags |= IEEE80211_TXCTL_SEND_AFTER_DTIM; | 385 | tx->control->flags |= IEEE80211_TXCTL_SEND_AFTER_DTIM; |
363 | 386 | ||
364 | return TXRX_CONTINUE; | 387 | return TX_CONTINUE; |
365 | } | 388 | } |
366 | 389 | ||
367 | static ieee80211_txrx_result | 390 | static ieee80211_tx_result |
368 | ieee80211_tx_h_unicast_ps_buf(struct ieee80211_txrx_data *tx) | 391 | ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) |
369 | { | 392 | { |
370 | struct sta_info *sta = tx->sta; | 393 | struct sta_info *sta = tx->sta; |
371 | DECLARE_MAC_BUF(mac); | 394 | DECLARE_MAC_BUF(mac); |
@@ -373,9 +396,10 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_txrx_data *tx) | |||
373 | if (unlikely(!sta || | 396 | if (unlikely(!sta || |
374 | ((tx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT && | 397 | ((tx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT && |
375 | (tx->fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PROBE_RESP))) | 398 | (tx->fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PROBE_RESP))) |
376 | return TXRX_CONTINUE; | 399 | return TX_CONTINUE; |
377 | 400 | ||
378 | if (unlikely((sta->flags & WLAN_STA_PS) && !sta->pspoll)) { | 401 | if (unlikely((sta->flags & WLAN_STA_PS) && |
402 | !(sta->flags & WLAN_STA_PSPOLL))) { | ||
379 | struct ieee80211_tx_packet_data *pkt_data; | 403 | struct ieee80211_tx_packet_data *pkt_data; |
380 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 404 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG |
381 | printk(KERN_DEBUG "STA %s aid %d: PS buffer (entries " | 405 | printk(KERN_DEBUG "STA %s aid %d: PS buffer (entries " |
@@ -383,7 +407,6 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_txrx_data *tx) | |||
383 | print_mac(mac, sta->addr), sta->aid, | 407 | print_mac(mac, sta->addr), sta->aid, |
384 | skb_queue_len(&sta->ps_tx_buf)); | 408 | skb_queue_len(&sta->ps_tx_buf)); |
385 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ | 409 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ |
386 | sta->flags |= WLAN_STA_TIM; | ||
387 | if (tx->local->total_ps_buffered >= TOTAL_MAX_TX_BUFFER) | 410 | if (tx->local->total_ps_buffered >= TOTAL_MAX_TX_BUFFER) |
388 | purge_old_ps_buffers(tx->local); | 411 | purge_old_ps_buffers(tx->local); |
389 | if (skb_queue_len(&sta->ps_tx_buf) >= STA_MAX_TX_BUFFER) { | 412 | if (skb_queue_len(&sta->ps_tx_buf) >= STA_MAX_TX_BUFFER) { |
@@ -396,18 +419,15 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_txrx_data *tx) | |||
396 | dev_kfree_skb(old); | 419 | dev_kfree_skb(old); |
397 | } else | 420 | } else |
398 | tx->local->total_ps_buffered++; | 421 | tx->local->total_ps_buffered++; |
422 | |||
399 | /* Queue frame to be sent after STA sends an PS Poll frame */ | 423 | /* Queue frame to be sent after STA sends an PS Poll frame */ |
400 | if (skb_queue_empty(&sta->ps_tx_buf)) { | 424 | if (skb_queue_empty(&sta->ps_tx_buf)) |
401 | if (tx->local->ops->set_tim) | 425 | sta_info_set_tim_bit(sta); |
402 | tx->local->ops->set_tim(local_to_hw(tx->local), | 426 | |
403 | sta->aid, 1); | ||
404 | if (tx->sdata->bss) | ||
405 | bss_tim_set(tx->local, tx->sdata->bss, sta->aid); | ||
406 | } | ||
407 | pkt_data = (struct ieee80211_tx_packet_data *)tx->skb->cb; | 427 | pkt_data = (struct ieee80211_tx_packet_data *)tx->skb->cb; |
408 | pkt_data->jiffies = jiffies; | 428 | pkt_data->jiffies = jiffies; |
409 | skb_queue_tail(&sta->ps_tx_buf, tx->skb); | 429 | skb_queue_tail(&sta->ps_tx_buf, tx->skb); |
410 | return TXRX_QUEUED; | 430 | return TX_QUEUED; |
411 | } | 431 | } |
412 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 432 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG |
413 | else if (unlikely(sta->flags & WLAN_STA_PS)) { | 433 | else if (unlikely(sta->flags & WLAN_STA_PS)) { |
@@ -416,40 +436,40 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_txrx_data *tx) | |||
416 | print_mac(mac, sta->addr)); | 436 | print_mac(mac, sta->addr)); |
417 | } | 437 | } |
418 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ | 438 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ |
419 | sta->pspoll = 0; | 439 | sta->flags &= ~WLAN_STA_PSPOLL; |
420 | 440 | ||
421 | return TXRX_CONTINUE; | 441 | return TX_CONTINUE; |
422 | } | 442 | } |
423 | 443 | ||
424 | static ieee80211_txrx_result | 444 | static ieee80211_tx_result |
425 | ieee80211_tx_h_ps_buf(struct ieee80211_txrx_data *tx) | 445 | ieee80211_tx_h_ps_buf(struct ieee80211_tx_data *tx) |
426 | { | 446 | { |
427 | if (unlikely(tx->flags & IEEE80211_TXRXD_TXPS_BUFFERED)) | 447 | if (unlikely(tx->flags & IEEE80211_TX_PS_BUFFERED)) |
428 | return TXRX_CONTINUE; | 448 | return TX_CONTINUE; |
429 | 449 | ||
430 | if (tx->flags & IEEE80211_TXRXD_TXUNICAST) | 450 | if (tx->flags & IEEE80211_TX_UNICAST) |
431 | return ieee80211_tx_h_unicast_ps_buf(tx); | 451 | return ieee80211_tx_h_unicast_ps_buf(tx); |
432 | else | 452 | else |
433 | return ieee80211_tx_h_multicast_ps_buf(tx); | 453 | return ieee80211_tx_h_multicast_ps_buf(tx); |
434 | } | 454 | } |
435 | 455 | ||
436 | static ieee80211_txrx_result | 456 | static ieee80211_tx_result |
437 | ieee80211_tx_h_select_key(struct ieee80211_txrx_data *tx) | 457 | ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx) |
438 | { | 458 | { |
439 | struct ieee80211_key *key; | 459 | struct ieee80211_key *key; |
440 | u16 fc = tx->fc; | 460 | u16 fc = tx->fc; |
441 | 461 | ||
442 | if (unlikely(tx->u.tx.control->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)) | 462 | if (unlikely(tx->control->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)) |
443 | tx->key = NULL; | 463 | tx->key = NULL; |
444 | else if (tx->sta && (key = rcu_dereference(tx->sta->key))) | 464 | else if (tx->sta && (key = rcu_dereference(tx->sta->key))) |
445 | tx->key = key; | 465 | tx->key = key; |
446 | else if ((key = rcu_dereference(tx->sdata->default_key))) | 466 | else if ((key = rcu_dereference(tx->sdata->default_key))) |
447 | tx->key = key; | 467 | tx->key = key; |
448 | else if (tx->sdata->drop_unencrypted && | 468 | else if (tx->sdata->drop_unencrypted && |
449 | !(tx->u.tx.control->flags & IEEE80211_TXCTL_EAPOL_FRAME) && | 469 | !(tx->control->flags & IEEE80211_TXCTL_EAPOL_FRAME) && |
450 | !(tx->flags & IEEE80211_TXRXD_TX_INJECTED)) { | 470 | !(tx->flags & IEEE80211_TX_INJECTED)) { |
451 | I802_DEBUG_INC(tx->local->tx_handlers_drop_unencrypted); | 471 | I802_DEBUG_INC(tx->local->tx_handlers_drop_unencrypted); |
452 | return TXRX_DROP; | 472 | return TX_DROP; |
453 | } else | 473 | } else |
454 | tx->key = NULL; | 474 | tx->key = NULL; |
455 | 475 | ||
@@ -476,13 +496,13 @@ ieee80211_tx_h_select_key(struct ieee80211_txrx_data *tx) | |||
476 | } | 496 | } |
477 | 497 | ||
478 | if (!tx->key || !(tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) | 498 | if (!tx->key || !(tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) |
479 | tx->u.tx.control->flags |= IEEE80211_TXCTL_DO_NOT_ENCRYPT; | 499 | tx->control->flags |= IEEE80211_TXCTL_DO_NOT_ENCRYPT; |
480 | 500 | ||
481 | return TXRX_CONTINUE; | 501 | return TX_CONTINUE; |
482 | } | 502 | } |
483 | 503 | ||
484 | static ieee80211_txrx_result | 504 | static ieee80211_tx_result |
485 | ieee80211_tx_h_fragment(struct ieee80211_txrx_data *tx) | 505 | ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx) |
486 | { | 506 | { |
487 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx->skb->data; | 507 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx->skb->data; |
488 | size_t hdrlen, per_fragm, num_fragm, payload_len, left; | 508 | size_t hdrlen, per_fragm, num_fragm, payload_len, left; |
@@ -492,8 +512,8 @@ ieee80211_tx_h_fragment(struct ieee80211_txrx_data *tx) | |||
492 | u8 *pos; | 512 | u8 *pos; |
493 | int frag_threshold = tx->local->fragmentation_threshold; | 513 | int frag_threshold = tx->local->fragmentation_threshold; |
494 | 514 | ||
495 | if (!(tx->flags & IEEE80211_TXRXD_FRAGMENTED)) | 515 | if (!(tx->flags & IEEE80211_TX_FRAGMENTED)) |
496 | return TXRX_CONTINUE; | 516 | return TX_CONTINUE; |
497 | 517 | ||
498 | first = tx->skb; | 518 | first = tx->skb; |
499 | 519 | ||
@@ -544,10 +564,10 @@ ieee80211_tx_h_fragment(struct ieee80211_txrx_data *tx) | |||
544 | } | 564 | } |
545 | skb_trim(first, hdrlen + per_fragm); | 565 | skb_trim(first, hdrlen + per_fragm); |
546 | 566 | ||
547 | tx->u.tx.num_extra_frag = num_fragm - 1; | 567 | tx->num_extra_frag = num_fragm - 1; |
548 | tx->u.tx.extra_frag = frags; | 568 | tx->extra_frag = frags; |
549 | 569 | ||
550 | return TXRX_CONTINUE; | 570 | return TX_CONTINUE; |
551 | 571 | ||
552 | fail: | 572 | fail: |
553 | printk(KERN_DEBUG "%s: failed to fragment frame\n", tx->dev->name); | 573 | printk(KERN_DEBUG "%s: failed to fragment frame\n", tx->dev->name); |
@@ -558,14 +578,14 @@ ieee80211_tx_h_fragment(struct ieee80211_txrx_data *tx) | |||
558 | kfree(frags); | 578 | kfree(frags); |
559 | } | 579 | } |
560 | I802_DEBUG_INC(tx->local->tx_handlers_drop_fragment); | 580 | I802_DEBUG_INC(tx->local->tx_handlers_drop_fragment); |
561 | return TXRX_DROP; | 581 | return TX_DROP; |
562 | } | 582 | } |
563 | 583 | ||
564 | static ieee80211_txrx_result | 584 | static ieee80211_tx_result |
565 | ieee80211_tx_h_encrypt(struct ieee80211_txrx_data *tx) | 585 | ieee80211_tx_h_encrypt(struct ieee80211_tx_data *tx) |
566 | { | 586 | { |
567 | if (!tx->key) | 587 | if (!tx->key) |
568 | return TXRX_CONTINUE; | 588 | return TX_CONTINUE; |
569 | 589 | ||
570 | switch (tx->key->conf.alg) { | 590 | switch (tx->key->conf.alg) { |
571 | case ALG_WEP: | 591 | case ALG_WEP: |
@@ -578,59 +598,60 @@ ieee80211_tx_h_encrypt(struct ieee80211_txrx_data *tx) | |||
578 | 598 | ||
579 | /* not reached */ | 599 | /* not reached */ |
580 | WARN_ON(1); | 600 | WARN_ON(1); |
581 | return TXRX_DROP; | 601 | return TX_DROP; |
582 | } | 602 | } |
583 | 603 | ||
584 | static ieee80211_txrx_result | 604 | static ieee80211_tx_result |
585 | ieee80211_tx_h_rate_ctrl(struct ieee80211_txrx_data *tx) | 605 | ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx) |
586 | { | 606 | { |
587 | struct rate_selection rsel; | 607 | struct rate_selection rsel; |
608 | struct ieee80211_supported_band *sband; | ||
609 | |||
610 | sband = tx->local->hw.wiphy->bands[tx->local->hw.conf.channel->band]; | ||
588 | 611 | ||
589 | if (likely(!tx->u.tx.rate)) { | 612 | if (likely(!tx->rate)) { |
590 | rate_control_get_rate(tx->dev, tx->u.tx.mode, tx->skb, &rsel); | 613 | rate_control_get_rate(tx->dev, sband, tx->skb, &rsel); |
591 | tx->u.tx.rate = rsel.rate; | 614 | tx->rate = rsel.rate; |
592 | if (unlikely(rsel.probe != NULL)) { | 615 | if (unlikely(rsel.probe)) { |
593 | tx->u.tx.control->flags |= | 616 | tx->control->flags |= |
594 | IEEE80211_TXCTL_RATE_CTRL_PROBE; | 617 | IEEE80211_TXCTL_RATE_CTRL_PROBE; |
595 | tx->flags |= IEEE80211_TXRXD_TXPROBE_LAST_FRAG; | 618 | tx->flags |= IEEE80211_TX_PROBE_LAST_FRAG; |
596 | tx->u.tx.control->alt_retry_rate = tx->u.tx.rate->val; | 619 | tx->control->alt_retry_rate = tx->rate; |
597 | tx->u.tx.rate = rsel.probe; | 620 | tx->rate = rsel.probe; |
598 | } else | 621 | } else |
599 | tx->u.tx.control->alt_retry_rate = -1; | 622 | tx->control->alt_retry_rate = NULL; |
600 | 623 | ||
601 | if (!tx->u.tx.rate) | 624 | if (!tx->rate) |
602 | return TXRX_DROP; | 625 | return TX_DROP; |
603 | } else | 626 | } else |
604 | tx->u.tx.control->alt_retry_rate = -1; | 627 | tx->control->alt_retry_rate = NULL; |
605 | 628 | ||
606 | if (tx->u.tx.mode->mode == MODE_IEEE80211G && | 629 | if (tx->sdata->bss_conf.use_cts_prot && |
607 | tx->sdata->bss_conf.use_cts_prot && | 630 | (tx->flags & IEEE80211_TX_FRAGMENTED) && rsel.nonerp) { |
608 | (tx->flags & IEEE80211_TXRXD_FRAGMENTED) && rsel.nonerp) { | 631 | tx->last_frag_rate = tx->rate; |
609 | tx->u.tx.last_frag_rate = tx->u.tx.rate; | ||
610 | if (rsel.probe) | 632 | if (rsel.probe) |
611 | tx->flags &= ~IEEE80211_TXRXD_TXPROBE_LAST_FRAG; | 633 | tx->flags &= ~IEEE80211_TX_PROBE_LAST_FRAG; |
612 | else | 634 | else |
613 | tx->flags |= IEEE80211_TXRXD_TXPROBE_LAST_FRAG; | 635 | tx->flags |= IEEE80211_TX_PROBE_LAST_FRAG; |
614 | tx->u.tx.rate = rsel.nonerp; | 636 | tx->rate = rsel.nonerp; |
615 | tx->u.tx.control->rate = rsel.nonerp; | 637 | tx->control->tx_rate = rsel.nonerp; |
616 | tx->u.tx.control->flags &= ~IEEE80211_TXCTL_RATE_CTRL_PROBE; | 638 | tx->control->flags &= ~IEEE80211_TXCTL_RATE_CTRL_PROBE; |
617 | } else { | 639 | } else { |
618 | tx->u.tx.last_frag_rate = tx->u.tx.rate; | 640 | tx->last_frag_rate = tx->rate; |
619 | tx->u.tx.control->rate = tx->u.tx.rate; | 641 | tx->control->tx_rate = tx->rate; |
620 | } | 642 | } |
621 | tx->u.tx.control->tx_rate = tx->u.tx.rate->val; | 643 | tx->control->tx_rate = tx->rate; |
622 | 644 | ||
623 | return TXRX_CONTINUE; | 645 | return TX_CONTINUE; |
624 | } | 646 | } |
625 | 647 | ||
626 | static ieee80211_txrx_result | 648 | static ieee80211_tx_result |
627 | ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx) | 649 | ieee80211_tx_h_misc(struct ieee80211_tx_data *tx) |
628 | { | 650 | { |
629 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx->skb->data; | 651 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx->skb->data; |
630 | u16 fc = le16_to_cpu(hdr->frame_control); | 652 | u16 fc = le16_to_cpu(hdr->frame_control); |
631 | u16 dur; | 653 | u16 dur; |
632 | struct ieee80211_tx_control *control = tx->u.tx.control; | 654 | struct ieee80211_tx_control *control = tx->control; |
633 | struct ieee80211_hw_mode *mode = tx->u.tx.mode; | ||
634 | 655 | ||
635 | if (!control->retry_limit) { | 656 | if (!control->retry_limit) { |
636 | if (!is_multicast_ether_addr(hdr->addr1)) { | 657 | if (!is_multicast_ether_addr(hdr->addr1)) { |
@@ -652,20 +673,20 @@ ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx) | |||
652 | } | 673 | } |
653 | } | 674 | } |
654 | 675 | ||
655 | if (tx->flags & IEEE80211_TXRXD_FRAGMENTED) { | 676 | if (tx->flags & IEEE80211_TX_FRAGMENTED) { |
656 | /* Do not use multiple retry rates when sending fragmented | 677 | /* Do not use multiple retry rates when sending fragmented |
657 | * frames. | 678 | * frames. |
658 | * TODO: The last fragment could still use multiple retry | 679 | * TODO: The last fragment could still use multiple retry |
659 | * rates. */ | 680 | * rates. */ |
660 | control->alt_retry_rate = -1; | 681 | control->alt_retry_rate = NULL; |
661 | } | 682 | } |
662 | 683 | ||
663 | /* Use CTS protection for unicast frames sent using extended rates if | 684 | /* Use CTS protection for unicast frames sent using extended rates if |
664 | * there are associated non-ERP stations and RTS/CTS is not configured | 685 | * there are associated non-ERP stations and RTS/CTS is not configured |
665 | * for the frame. */ | 686 | * for the frame. */ |
666 | if (mode->mode == MODE_IEEE80211G && | 687 | if ((tx->sdata->flags & IEEE80211_SDATA_OPERATING_GMODE) && |
667 | (tx->u.tx.rate->flags & IEEE80211_RATE_ERP) && | 688 | (tx->rate->flags & IEEE80211_RATE_ERP_G) && |
668 | (tx->flags & IEEE80211_TXRXD_TXUNICAST) && | 689 | (tx->flags & IEEE80211_TX_UNICAST) && |
669 | tx->sdata->bss_conf.use_cts_prot && | 690 | tx->sdata->bss_conf.use_cts_prot && |
670 | !(control->flags & IEEE80211_TXCTL_USE_RTS_CTS)) | 691 | !(control->flags & IEEE80211_TXCTL_USE_RTS_CTS)) |
671 | control->flags |= IEEE80211_TXCTL_USE_CTS_PROTECT; | 692 | control->flags |= IEEE80211_TXCTL_USE_CTS_PROTECT; |
@@ -674,62 +695,77 @@ ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx) | |||
674 | * short preambles at the selected rate and short preambles are | 695 | * short preambles at the selected rate and short preambles are |
675 | * available on the network at the current point in time. */ | 696 | * available on the network at the current point in time. */ |
676 | if (((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) && | 697 | if (((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) && |
677 | (tx->u.tx.rate->flags & IEEE80211_RATE_PREAMBLE2) && | 698 | (tx->rate->flags & IEEE80211_RATE_SHORT_PREAMBLE) && |
678 | tx->sdata->bss_conf.use_short_preamble && | 699 | tx->sdata->bss_conf.use_short_preamble && |
679 | (!tx->sta || (tx->sta->flags & WLAN_STA_SHORT_PREAMBLE))) { | 700 | (!tx->sta || (tx->sta->flags & WLAN_STA_SHORT_PREAMBLE))) { |
680 | tx->u.tx.control->tx_rate = tx->u.tx.rate->val2; | 701 | tx->control->flags |= IEEE80211_TXCTL_SHORT_PREAMBLE; |
681 | } | 702 | } |
682 | 703 | ||
683 | /* Setup duration field for the first fragment of the frame. Duration | 704 | /* Setup duration field for the first fragment of the frame. Duration |
684 | * for remaining fragments will be updated when they are being sent | 705 | * for remaining fragments will be updated when they are being sent |
685 | * to low-level driver in ieee80211_tx(). */ | 706 | * to low-level driver in ieee80211_tx(). */ |
686 | dur = ieee80211_duration(tx, is_multicast_ether_addr(hdr->addr1), | 707 | dur = ieee80211_duration(tx, is_multicast_ether_addr(hdr->addr1), |
687 | (tx->flags & IEEE80211_TXRXD_FRAGMENTED) ? | 708 | (tx->flags & IEEE80211_TX_FRAGMENTED) ? |
688 | tx->u.tx.extra_frag[0]->len : 0); | 709 | tx->extra_frag[0]->len : 0); |
689 | hdr->duration_id = cpu_to_le16(dur); | 710 | hdr->duration_id = cpu_to_le16(dur); |
690 | 711 | ||
691 | if ((control->flags & IEEE80211_TXCTL_USE_RTS_CTS) || | 712 | if ((control->flags & IEEE80211_TXCTL_USE_RTS_CTS) || |
692 | (control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT)) { | 713 | (control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT)) { |
693 | struct ieee80211_rate *rate; | 714 | struct ieee80211_supported_band *sband; |
715 | struct ieee80211_rate *rate, *baserate; | ||
716 | int idx; | ||
717 | |||
718 | sband = tx->local->hw.wiphy->bands[ | ||
719 | tx->local->hw.conf.channel->band]; | ||
694 | 720 | ||
695 | /* Do not use multiple retry rates when using RTS/CTS */ | 721 | /* Do not use multiple retry rates when using RTS/CTS */ |
696 | control->alt_retry_rate = -1; | 722 | control->alt_retry_rate = NULL; |
697 | 723 | ||
698 | /* Use min(data rate, max base rate) as CTS/RTS rate */ | 724 | /* Use min(data rate, max base rate) as CTS/RTS rate */ |
699 | rate = tx->u.tx.rate; | 725 | rate = tx->rate; |
700 | while (rate > mode->rates && | 726 | baserate = NULL; |
701 | !(rate->flags & IEEE80211_RATE_BASIC)) | 727 | |
702 | rate--; | 728 | for (idx = 0; idx < sband->n_bitrates; idx++) { |
729 | if (sband->bitrates[idx].bitrate > rate->bitrate) | ||
730 | continue; | ||
731 | if (tx->sdata->basic_rates & BIT(idx) && | ||
732 | (!baserate || | ||
733 | (baserate->bitrate < sband->bitrates[idx].bitrate))) | ||
734 | baserate = &sband->bitrates[idx]; | ||
735 | } | ||
703 | 736 | ||
704 | control->rts_cts_rate = rate->val; | 737 | if (baserate) |
705 | control->rts_rate = rate; | 738 | control->rts_cts_rate = baserate; |
739 | else | ||
740 | control->rts_cts_rate = &sband->bitrates[0]; | ||
706 | } | 741 | } |
707 | 742 | ||
708 | if (tx->sta) { | 743 | if (tx->sta) { |
744 | control->aid = tx->sta->aid; | ||
709 | tx->sta->tx_packets++; | 745 | tx->sta->tx_packets++; |
710 | tx->sta->tx_fragments++; | 746 | tx->sta->tx_fragments++; |
711 | tx->sta->tx_bytes += tx->skb->len; | 747 | tx->sta->tx_bytes += tx->skb->len; |
712 | if (tx->u.tx.extra_frag) { | 748 | if (tx->extra_frag) { |
713 | int i; | 749 | int i; |
714 | tx->sta->tx_fragments += tx->u.tx.num_extra_frag; | 750 | tx->sta->tx_fragments += tx->num_extra_frag; |
715 | for (i = 0; i < tx->u.tx.num_extra_frag; i++) { | 751 | for (i = 0; i < tx->num_extra_frag; i++) { |
716 | tx->sta->tx_bytes += | 752 | tx->sta->tx_bytes += |
717 | tx->u.tx.extra_frag[i]->len; | 753 | tx->extra_frag[i]->len; |
718 | } | 754 | } |
719 | } | 755 | } |
720 | } | 756 | } |
721 | 757 | ||
722 | return TXRX_CONTINUE; | 758 | return TX_CONTINUE; |
723 | } | 759 | } |
724 | 760 | ||
725 | static ieee80211_txrx_result | 761 | static ieee80211_tx_result |
726 | ieee80211_tx_h_load_stats(struct ieee80211_txrx_data *tx) | 762 | ieee80211_tx_h_load_stats(struct ieee80211_tx_data *tx) |
727 | { | 763 | { |
728 | struct ieee80211_local *local = tx->local; | 764 | struct ieee80211_local *local = tx->local; |
729 | struct ieee80211_hw_mode *mode = tx->u.tx.mode; | ||
730 | struct sk_buff *skb = tx->skb; | 765 | struct sk_buff *skb = tx->skb; |
731 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | 766 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; |
732 | u32 load = 0, hdrtime; | 767 | u32 load = 0, hdrtime; |
768 | struct ieee80211_rate *rate = tx->rate; | ||
733 | 769 | ||
734 | /* TODO: this could be part of tx_status handling, so that the number | 770 | /* TODO: this could be part of tx_status handling, so that the number |
735 | * of retries would be known; TX rate should in that case be stored | 771 | * of retries would be known; TX rate should in that case be stored |
@@ -740,9 +776,9 @@ ieee80211_tx_h_load_stats(struct ieee80211_txrx_data *tx) | |||
740 | /* 1 bit at 1 Mbit/s takes 1 usec; in channel_use values, | 776 | /* 1 bit at 1 Mbit/s takes 1 usec; in channel_use values, |
741 | * 1 usec = 1/8 * (1080 / 10) = 13.5 */ | 777 | * 1 usec = 1/8 * (1080 / 10) = 13.5 */ |
742 | 778 | ||
743 | if (mode->mode == MODE_IEEE80211A || | 779 | if (tx->channel->band == IEEE80211_BAND_5GHZ || |
744 | (mode->mode == MODE_IEEE80211G && | 780 | (tx->channel->band == IEEE80211_BAND_2GHZ && |
745 | tx->u.tx.rate->flags & IEEE80211_RATE_ERP)) | 781 | rate->flags & IEEE80211_RATE_ERP_G)) |
746 | hdrtime = CHAN_UTIL_HDR_SHORT; | 782 | hdrtime = CHAN_UTIL_HDR_SHORT; |
747 | else | 783 | else |
748 | hdrtime = CHAN_UTIL_HDR_LONG; | 784 | hdrtime = CHAN_UTIL_HDR_LONG; |
@@ -751,19 +787,20 @@ ieee80211_tx_h_load_stats(struct ieee80211_txrx_data *tx) | |||
751 | if (!is_multicast_ether_addr(hdr->addr1)) | 787 | if (!is_multicast_ether_addr(hdr->addr1)) |
752 | load += hdrtime; | 788 | load += hdrtime; |
753 | 789 | ||
754 | if (tx->u.tx.control->flags & IEEE80211_TXCTL_USE_RTS_CTS) | 790 | if (tx->control->flags & IEEE80211_TXCTL_USE_RTS_CTS) |
755 | load += 2 * hdrtime; | 791 | load += 2 * hdrtime; |
756 | else if (tx->u.tx.control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) | 792 | else if (tx->control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) |
757 | load += hdrtime; | 793 | load += hdrtime; |
758 | 794 | ||
759 | load += skb->len * tx->u.tx.rate->rate_inv; | 795 | /* TODO: optimise again */ |
796 | load += skb->len * CHAN_UTIL_RATE_LCM / rate->bitrate; | ||
760 | 797 | ||
761 | if (tx->u.tx.extra_frag) { | 798 | if (tx->extra_frag) { |
762 | int i; | 799 | int i; |
763 | for (i = 0; i < tx->u.tx.num_extra_frag; i++) { | 800 | for (i = 0; i < tx->num_extra_frag; i++) { |
764 | load += 2 * hdrtime; | 801 | load += 2 * hdrtime; |
765 | load += tx->u.tx.extra_frag[i]->len * | 802 | load += tx->extra_frag[i]->len * |
766 | tx->u.tx.rate->rate; | 803 | tx->rate->bitrate; |
767 | } | 804 | } |
768 | } | 805 | } |
769 | 806 | ||
@@ -774,13 +811,12 @@ ieee80211_tx_h_load_stats(struct ieee80211_txrx_data *tx) | |||
774 | tx->sta->channel_use_raw += load; | 811 | tx->sta->channel_use_raw += load; |
775 | tx->sdata->channel_use_raw += load; | 812 | tx->sdata->channel_use_raw += load; |
776 | 813 | ||
777 | return TXRX_CONTINUE; | 814 | return TX_CONTINUE; |
778 | } | 815 | } |
779 | 816 | ||
780 | /* TODO: implement register/unregister functions for adding TX/RX handlers | ||
781 | * into ordered list */ | ||
782 | 817 | ||
783 | ieee80211_tx_handler ieee80211_tx_handlers[] = | 818 | typedef ieee80211_tx_result (*ieee80211_tx_handler)(struct ieee80211_tx_data *); |
819 | static ieee80211_tx_handler ieee80211_tx_handlers[] = | ||
784 | { | 820 | { |
785 | ieee80211_tx_h_check_assoc, | 821 | ieee80211_tx_h_check_assoc, |
786 | ieee80211_tx_h_sequence, | 822 | ieee80211_tx_h_sequence, |
@@ -801,8 +837,8 @@ ieee80211_tx_handler ieee80211_tx_handlers[] = | |||
801 | * deal with packet injection down monitor interface | 837 | * deal with packet injection down monitor interface |
802 | * with Radiotap Header -- only called for monitor mode interface | 838 | * with Radiotap Header -- only called for monitor mode interface |
803 | */ | 839 | */ |
804 | static ieee80211_txrx_result | 840 | static ieee80211_tx_result |
805 | __ieee80211_parse_tx_radiotap(struct ieee80211_txrx_data *tx, | 841 | __ieee80211_parse_tx_radiotap(struct ieee80211_tx_data *tx, |
806 | struct sk_buff *skb) | 842 | struct sk_buff *skb) |
807 | { | 843 | { |
808 | /* | 844 | /* |
@@ -816,13 +852,15 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_txrx_data *tx, | |||
816 | struct ieee80211_radiotap_iterator iterator; | 852 | struct ieee80211_radiotap_iterator iterator; |
817 | struct ieee80211_radiotap_header *rthdr = | 853 | struct ieee80211_radiotap_header *rthdr = |
818 | (struct ieee80211_radiotap_header *) skb->data; | 854 | (struct ieee80211_radiotap_header *) skb->data; |
819 | struct ieee80211_hw_mode *mode = tx->local->hw.conf.mode; | 855 | struct ieee80211_supported_band *sband; |
820 | int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len); | 856 | int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len); |
821 | struct ieee80211_tx_control *control = tx->u.tx.control; | 857 | struct ieee80211_tx_control *control = tx->control; |
858 | |||
859 | sband = tx->local->hw.wiphy->bands[tx->local->hw.conf.channel->band]; | ||
822 | 860 | ||
823 | control->flags |= IEEE80211_TXCTL_DO_NOT_ENCRYPT; | 861 | control->flags |= IEEE80211_TXCTL_DO_NOT_ENCRYPT; |
824 | tx->flags |= IEEE80211_TXRXD_TX_INJECTED; | 862 | tx->flags |= IEEE80211_TX_INJECTED; |
825 | tx->flags &= ~IEEE80211_TXRXD_FRAGMENTED; | 863 | tx->flags &= ~IEEE80211_TX_FRAGMENTED; |
826 | 864 | ||
827 | /* | 865 | /* |
828 | * for every radiotap entry that is present | 866 | * for every radiotap entry that is present |
@@ -852,11 +890,13 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_txrx_data *tx, | |||
852 | * ieee80211 rate int is in 100kbps units eg, 0x0a=1Mbps | 890 | * ieee80211 rate int is in 100kbps units eg, 0x0a=1Mbps |
853 | */ | 891 | */ |
854 | target_rate = (*iterator.this_arg) * 5; | 892 | target_rate = (*iterator.this_arg) * 5; |
855 | for (i = 0; i < mode->num_rates; i++) { | 893 | for (i = 0; i < sband->n_bitrates; i++) { |
856 | struct ieee80211_rate *r = &mode->rates[i]; | 894 | struct ieee80211_rate *r; |
895 | |||
896 | r = &sband->bitrates[i]; | ||
857 | 897 | ||
858 | if (r->rate == target_rate) { | 898 | if (r->bitrate == target_rate) { |
859 | tx->u.tx.rate = r; | 899 | tx->rate = r; |
860 | break; | 900 | break; |
861 | } | 901 | } |
862 | } | 902 | } |
@@ -870,9 +910,11 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_txrx_data *tx, | |||
870 | control->antenna_sel_tx = (*iterator.this_arg) + 1; | 910 | control->antenna_sel_tx = (*iterator.this_arg) + 1; |
871 | break; | 911 | break; |
872 | 912 | ||
913 | #if 0 | ||
873 | case IEEE80211_RADIOTAP_DBM_TX_POWER: | 914 | case IEEE80211_RADIOTAP_DBM_TX_POWER: |
874 | control->power_level = *iterator.this_arg; | 915 | control->power_level = *iterator.this_arg; |
875 | break; | 916 | break; |
917 | #endif | ||
876 | 918 | ||
877 | case IEEE80211_RADIOTAP_FLAGS: | 919 | case IEEE80211_RADIOTAP_FLAGS: |
878 | if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FCS) { | 920 | if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FCS) { |
@@ -884,7 +926,7 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_txrx_data *tx, | |||
884 | * on transmission | 926 | * on transmission |
885 | */ | 927 | */ |
886 | if (skb->len < (iterator.max_length + FCS_LEN)) | 928 | if (skb->len < (iterator.max_length + FCS_LEN)) |
887 | return TXRX_DROP; | 929 | return TX_DROP; |
888 | 930 | ||
889 | skb_trim(skb, skb->len - FCS_LEN); | 931 | skb_trim(skb, skb->len - FCS_LEN); |
890 | } | 932 | } |
@@ -892,7 +934,7 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_txrx_data *tx, | |||
892 | control->flags &= | 934 | control->flags &= |
893 | ~IEEE80211_TXCTL_DO_NOT_ENCRYPT; | 935 | ~IEEE80211_TXCTL_DO_NOT_ENCRYPT; |
894 | if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FRAG) | 936 | if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FRAG) |
895 | tx->flags |= IEEE80211_TXRXD_FRAGMENTED; | 937 | tx->flags |= IEEE80211_TX_FRAGMENTED; |
896 | break; | 938 | break; |
897 | 939 | ||
898 | /* | 940 | /* |
@@ -907,7 +949,7 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_txrx_data *tx, | |||
907 | } | 949 | } |
908 | 950 | ||
909 | if (ret != -ENOENT) /* ie, if we didn't simply run out of fields */ | 951 | if (ret != -ENOENT) /* ie, if we didn't simply run out of fields */ |
910 | return TXRX_DROP; | 952 | return TX_DROP; |
911 | 953 | ||
912 | /* | 954 | /* |
913 | * remove the radiotap header | 955 | * remove the radiotap header |
@@ -916,14 +958,14 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_txrx_data *tx, | |||
916 | */ | 958 | */ |
917 | skb_pull(skb, iterator.max_length); | 959 | skb_pull(skb, iterator.max_length); |
918 | 960 | ||
919 | return TXRX_CONTINUE; | 961 | return TX_CONTINUE; |
920 | } | 962 | } |
921 | 963 | ||
922 | /* | 964 | /* |
923 | * initialises @tx | 965 | * initialises @tx |
924 | */ | 966 | */ |
925 | static ieee80211_txrx_result | 967 | static ieee80211_tx_result |
926 | __ieee80211_tx_prepare(struct ieee80211_txrx_data *tx, | 968 | __ieee80211_tx_prepare(struct ieee80211_tx_data *tx, |
927 | struct sk_buff *skb, | 969 | struct sk_buff *skb, |
928 | struct net_device *dev, | 970 | struct net_device *dev, |
929 | struct ieee80211_tx_control *control) | 971 | struct ieee80211_tx_control *control) |
@@ -939,18 +981,18 @@ __ieee80211_tx_prepare(struct ieee80211_txrx_data *tx, | |||
939 | tx->dev = dev; /* use original interface */ | 981 | tx->dev = dev; /* use original interface */ |
940 | tx->local = local; | 982 | tx->local = local; |
941 | tx->sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 983 | tx->sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
942 | tx->u.tx.control = control; | 984 | tx->control = control; |
943 | /* | 985 | /* |
944 | * Set this flag (used below to indicate "automatic fragmentation"), | 986 | * Set this flag (used below to indicate "automatic fragmentation"), |
945 | * it will be cleared/left by radiotap as desired. | 987 | * it will be cleared/left by radiotap as desired. |
946 | */ | 988 | */ |
947 | tx->flags |= IEEE80211_TXRXD_FRAGMENTED; | 989 | tx->flags |= IEEE80211_TX_FRAGMENTED; |
948 | 990 | ||
949 | /* process and remove the injection radiotap header */ | 991 | /* process and remove the injection radiotap header */ |
950 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 992 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
951 | if (unlikely(sdata->vif.type == IEEE80211_IF_TYPE_MNTR)) { | 993 | if (unlikely(sdata->vif.type == IEEE80211_IF_TYPE_MNTR)) { |
952 | if (__ieee80211_parse_tx_radiotap(tx, skb) == TXRX_DROP) | 994 | if (__ieee80211_parse_tx_radiotap(tx, skb) == TX_DROP) |
953 | return TXRX_DROP; | 995 | return TX_DROP; |
954 | 996 | ||
955 | /* | 997 | /* |
956 | * __ieee80211_parse_tx_radiotap has now removed | 998 | * __ieee80211_parse_tx_radiotap has now removed |
@@ -965,27 +1007,27 @@ __ieee80211_tx_prepare(struct ieee80211_txrx_data *tx, | |||
965 | tx->fc = le16_to_cpu(hdr->frame_control); | 1007 | tx->fc = le16_to_cpu(hdr->frame_control); |
966 | 1008 | ||
967 | if (is_multicast_ether_addr(hdr->addr1)) { | 1009 | if (is_multicast_ether_addr(hdr->addr1)) { |
968 | tx->flags &= ~IEEE80211_TXRXD_TXUNICAST; | 1010 | tx->flags &= ~IEEE80211_TX_UNICAST; |
969 | control->flags |= IEEE80211_TXCTL_NO_ACK; | 1011 | control->flags |= IEEE80211_TXCTL_NO_ACK; |
970 | } else { | 1012 | } else { |
971 | tx->flags |= IEEE80211_TXRXD_TXUNICAST; | 1013 | tx->flags |= IEEE80211_TX_UNICAST; |
972 | control->flags &= ~IEEE80211_TXCTL_NO_ACK; | 1014 | control->flags &= ~IEEE80211_TXCTL_NO_ACK; |
973 | } | 1015 | } |
974 | 1016 | ||
975 | if (tx->flags & IEEE80211_TXRXD_FRAGMENTED) { | 1017 | if (tx->flags & IEEE80211_TX_FRAGMENTED) { |
976 | if ((tx->flags & IEEE80211_TXRXD_TXUNICAST) && | 1018 | if ((tx->flags & IEEE80211_TX_UNICAST) && |
977 | skb->len + FCS_LEN > local->fragmentation_threshold && | 1019 | skb->len + FCS_LEN > local->fragmentation_threshold && |
978 | !local->ops->set_frag_threshold) | 1020 | !local->ops->set_frag_threshold) |
979 | tx->flags |= IEEE80211_TXRXD_FRAGMENTED; | 1021 | tx->flags |= IEEE80211_TX_FRAGMENTED; |
980 | else | 1022 | else |
981 | tx->flags &= ~IEEE80211_TXRXD_FRAGMENTED; | 1023 | tx->flags &= ~IEEE80211_TX_FRAGMENTED; |
982 | } | 1024 | } |
983 | 1025 | ||
984 | if (!tx->sta) | 1026 | if (!tx->sta) |
985 | control->flags |= IEEE80211_TXCTL_CLEAR_DST_MASK; | 1027 | control->flags |= IEEE80211_TXCTL_CLEAR_PS_FILT; |
986 | else if (tx->sta->clear_dst_mask) { | 1028 | else if (tx->sta->flags & WLAN_STA_CLEAR_PS_FILT) { |
987 | control->flags |= IEEE80211_TXCTL_CLEAR_DST_MASK; | 1029 | control->flags |= IEEE80211_TXCTL_CLEAR_PS_FILT; |
988 | tx->sta->clear_dst_mask = 0; | 1030 | tx->sta->flags &= ~WLAN_STA_CLEAR_PS_FILT; |
989 | } | 1031 | } |
990 | 1032 | ||
991 | hdrlen = ieee80211_get_hdrlen(tx->fc); | 1033 | hdrlen = ieee80211_get_hdrlen(tx->fc); |
@@ -995,13 +1037,13 @@ __ieee80211_tx_prepare(struct ieee80211_txrx_data *tx, | |||
995 | } | 1037 | } |
996 | control->flags |= IEEE80211_TXCTL_FIRST_FRAGMENT; | 1038 | control->flags |= IEEE80211_TXCTL_FIRST_FRAGMENT; |
997 | 1039 | ||
998 | return TXRX_CONTINUE; | 1040 | return TX_CONTINUE; |
999 | } | 1041 | } |
1000 | 1042 | ||
1001 | /* | 1043 | /* |
1002 | * NB: @tx is uninitialised when passed in here | 1044 | * NB: @tx is uninitialised when passed in here |
1003 | */ | 1045 | */ |
1004 | static int ieee80211_tx_prepare(struct ieee80211_txrx_data *tx, | 1046 | static int ieee80211_tx_prepare(struct ieee80211_tx_data *tx, |
1005 | struct sk_buff *skb, | 1047 | struct sk_buff *skb, |
1006 | struct net_device *mdev, | 1048 | struct net_device *mdev, |
1007 | struct ieee80211_tx_control *control) | 1049 | struct ieee80211_tx_control *control) |
@@ -1024,9 +1066,9 @@ static int ieee80211_tx_prepare(struct ieee80211_txrx_data *tx, | |||
1024 | } | 1066 | } |
1025 | 1067 | ||
1026 | static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb, | 1068 | static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb, |
1027 | struct ieee80211_txrx_data *tx) | 1069 | struct ieee80211_tx_data *tx) |
1028 | { | 1070 | { |
1029 | struct ieee80211_tx_control *control = tx->u.tx.control; | 1071 | struct ieee80211_tx_control *control = tx->control; |
1030 | int ret, i; | 1072 | int ret, i; |
1031 | 1073 | ||
1032 | if (!ieee80211_qdisc_installed(local->mdev) && | 1074 | if (!ieee80211_qdisc_installed(local->mdev) && |
@@ -1043,20 +1085,20 @@ static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb, | |||
1043 | local->mdev->trans_start = jiffies; | 1085 | local->mdev->trans_start = jiffies; |
1044 | ieee80211_led_tx(local, 1); | 1086 | ieee80211_led_tx(local, 1); |
1045 | } | 1087 | } |
1046 | if (tx->u.tx.extra_frag) { | 1088 | if (tx->extra_frag) { |
1047 | control->flags &= ~(IEEE80211_TXCTL_USE_RTS_CTS | | 1089 | control->flags &= ~(IEEE80211_TXCTL_USE_RTS_CTS | |
1048 | IEEE80211_TXCTL_USE_CTS_PROTECT | | 1090 | IEEE80211_TXCTL_USE_CTS_PROTECT | |
1049 | IEEE80211_TXCTL_CLEAR_DST_MASK | | 1091 | IEEE80211_TXCTL_CLEAR_PS_FILT | |
1050 | IEEE80211_TXCTL_FIRST_FRAGMENT); | 1092 | IEEE80211_TXCTL_FIRST_FRAGMENT); |
1051 | for (i = 0; i < tx->u.tx.num_extra_frag; i++) { | 1093 | for (i = 0; i < tx->num_extra_frag; i++) { |
1052 | if (!tx->u.tx.extra_frag[i]) | 1094 | if (!tx->extra_frag[i]) |
1053 | continue; | 1095 | continue; |
1054 | if (__ieee80211_queue_stopped(local, control->queue)) | 1096 | if (__ieee80211_queue_stopped(local, control->queue)) |
1055 | return IEEE80211_TX_FRAG_AGAIN; | 1097 | return IEEE80211_TX_FRAG_AGAIN; |
1056 | if (i == tx->u.tx.num_extra_frag) { | 1098 | if (i == tx->num_extra_frag) { |
1057 | control->tx_rate = tx->u.tx.last_frag_hwrate; | 1099 | control->tx_rate = tx->last_frag_rate; |
1058 | control->rate = tx->u.tx.last_frag_rate; | 1100 | |
1059 | if (tx->flags & IEEE80211_TXRXD_TXPROBE_LAST_FRAG) | 1101 | if (tx->flags & IEEE80211_TX_PROBE_LAST_FRAG) |
1060 | control->flags |= | 1102 | control->flags |= |
1061 | IEEE80211_TXCTL_RATE_CTRL_PROBE; | 1103 | IEEE80211_TXCTL_RATE_CTRL_PROBE; |
1062 | else | 1104 | else |
@@ -1066,18 +1108,18 @@ static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb, | |||
1066 | 1108 | ||
1067 | ieee80211_dump_frame(wiphy_name(local->hw.wiphy), | 1109 | ieee80211_dump_frame(wiphy_name(local->hw.wiphy), |
1068 | "TX to low-level driver", | 1110 | "TX to low-level driver", |
1069 | tx->u.tx.extra_frag[i]); | 1111 | tx->extra_frag[i]); |
1070 | ret = local->ops->tx(local_to_hw(local), | 1112 | ret = local->ops->tx(local_to_hw(local), |
1071 | tx->u.tx.extra_frag[i], | 1113 | tx->extra_frag[i], |
1072 | control); | 1114 | control); |
1073 | if (ret) | 1115 | if (ret) |
1074 | return IEEE80211_TX_FRAG_AGAIN; | 1116 | return IEEE80211_TX_FRAG_AGAIN; |
1075 | local->mdev->trans_start = jiffies; | 1117 | local->mdev->trans_start = jiffies; |
1076 | ieee80211_led_tx(local, 1); | 1118 | ieee80211_led_tx(local, 1); |
1077 | tx->u.tx.extra_frag[i] = NULL; | 1119 | tx->extra_frag[i] = NULL; |
1078 | } | 1120 | } |
1079 | kfree(tx->u.tx.extra_frag); | 1121 | kfree(tx->extra_frag); |
1080 | tx->u.tx.extra_frag = NULL; | 1122 | tx->extra_frag = NULL; |
1081 | } | 1123 | } |
1082 | return IEEE80211_TX_OK; | 1124 | return IEEE80211_TX_OK; |
1083 | } | 1125 | } |
@@ -1088,8 +1130,8 @@ static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb, | |||
1088 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 1130 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
1089 | struct sta_info *sta; | 1131 | struct sta_info *sta; |
1090 | ieee80211_tx_handler *handler; | 1132 | ieee80211_tx_handler *handler; |
1091 | struct ieee80211_txrx_data tx; | 1133 | struct ieee80211_tx_data tx; |
1092 | ieee80211_txrx_result res = TXRX_DROP, res_prepare; | 1134 | ieee80211_tx_result res = TX_DROP, res_prepare; |
1093 | int ret, i; | 1135 | int ret, i; |
1094 | 1136 | ||
1095 | WARN_ON(__ieee80211_queue_pending(local, control->queue)); | 1137 | WARN_ON(__ieee80211_queue_pending(local, control->queue)); |
@@ -1099,59 +1141,52 @@ static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb, | |||
1099 | return 0; | 1141 | return 0; |
1100 | } | 1142 | } |
1101 | 1143 | ||
1144 | rcu_read_lock(); | ||
1145 | |||
1102 | /* initialises tx */ | 1146 | /* initialises tx */ |
1103 | res_prepare = __ieee80211_tx_prepare(&tx, skb, dev, control); | 1147 | res_prepare = __ieee80211_tx_prepare(&tx, skb, dev, control); |
1104 | 1148 | ||
1105 | if (res_prepare == TXRX_DROP) { | 1149 | if (res_prepare == TX_DROP) { |
1106 | dev_kfree_skb(skb); | 1150 | dev_kfree_skb(skb); |
1151 | rcu_read_unlock(); | ||
1107 | return 0; | 1152 | return 0; |
1108 | } | 1153 | } |
1109 | 1154 | ||
1110 | /* | ||
1111 | * key references are protected using RCU and this requires that | ||
1112 | * we are in a read-site RCU section during receive processing | ||
1113 | */ | ||
1114 | rcu_read_lock(); | ||
1115 | |||
1116 | sta = tx.sta; | 1155 | sta = tx.sta; |
1117 | tx.u.tx.mode = local->hw.conf.mode; | 1156 | tx.channel = local->hw.conf.channel; |
1118 | 1157 | ||
1119 | for (handler = local->tx_handlers; *handler != NULL; | 1158 | for (handler = ieee80211_tx_handlers; *handler != NULL; |
1120 | handler++) { | 1159 | handler++) { |
1121 | res = (*handler)(&tx); | 1160 | res = (*handler)(&tx); |
1122 | if (res != TXRX_CONTINUE) | 1161 | if (res != TX_CONTINUE) |
1123 | break; | 1162 | break; |
1124 | } | 1163 | } |
1125 | 1164 | ||
1126 | skb = tx.skb; /* handlers are allowed to change skb */ | 1165 | skb = tx.skb; /* handlers are allowed to change skb */ |
1127 | 1166 | ||
1128 | if (sta) | 1167 | if (unlikely(res == TX_DROP)) { |
1129 | sta_info_put(sta); | ||
1130 | |||
1131 | if (unlikely(res == TXRX_DROP)) { | ||
1132 | I802_DEBUG_INC(local->tx_handlers_drop); | 1168 | I802_DEBUG_INC(local->tx_handlers_drop); |
1133 | goto drop; | 1169 | goto drop; |
1134 | } | 1170 | } |
1135 | 1171 | ||
1136 | if (unlikely(res == TXRX_QUEUED)) { | 1172 | if (unlikely(res == TX_QUEUED)) { |
1137 | I802_DEBUG_INC(local->tx_handlers_queued); | 1173 | I802_DEBUG_INC(local->tx_handlers_queued); |
1138 | rcu_read_unlock(); | 1174 | rcu_read_unlock(); |
1139 | return 0; | 1175 | return 0; |
1140 | } | 1176 | } |
1141 | 1177 | ||
1142 | if (tx.u.tx.extra_frag) { | 1178 | if (tx.extra_frag) { |
1143 | for (i = 0; i < tx.u.tx.num_extra_frag; i++) { | 1179 | for (i = 0; i < tx.num_extra_frag; i++) { |
1144 | int next_len, dur; | 1180 | int next_len, dur; |
1145 | struct ieee80211_hdr *hdr = | 1181 | struct ieee80211_hdr *hdr = |
1146 | (struct ieee80211_hdr *) | 1182 | (struct ieee80211_hdr *) |
1147 | tx.u.tx.extra_frag[i]->data; | 1183 | tx.extra_frag[i]->data; |
1148 | 1184 | ||
1149 | if (i + 1 < tx.u.tx.num_extra_frag) { | 1185 | if (i + 1 < tx.num_extra_frag) { |
1150 | next_len = tx.u.tx.extra_frag[i + 1]->len; | 1186 | next_len = tx.extra_frag[i + 1]->len; |
1151 | } else { | 1187 | } else { |
1152 | next_len = 0; | 1188 | next_len = 0; |
1153 | tx.u.tx.rate = tx.u.tx.last_frag_rate; | 1189 | tx.rate = tx.last_frag_rate; |
1154 | tx.u.tx.last_frag_hwrate = tx.u.tx.rate->val; | ||
1155 | } | 1190 | } |
1156 | dur = ieee80211_duration(&tx, 0, next_len); | 1191 | dur = ieee80211_duration(&tx, 0, next_len); |
1157 | hdr->duration_id = cpu_to_le16(dur); | 1192 | hdr->duration_id = cpu_to_le16(dur); |
@@ -1186,12 +1221,11 @@ retry: | |||
1186 | memcpy(&store->control, control, | 1221 | memcpy(&store->control, control, |
1187 | sizeof(struct ieee80211_tx_control)); | 1222 | sizeof(struct ieee80211_tx_control)); |
1188 | store->skb = skb; | 1223 | store->skb = skb; |
1189 | store->extra_frag = tx.u.tx.extra_frag; | 1224 | store->extra_frag = tx.extra_frag; |
1190 | store->num_extra_frag = tx.u.tx.num_extra_frag; | 1225 | store->num_extra_frag = tx.num_extra_frag; |
1191 | store->last_frag_hwrate = tx.u.tx.last_frag_hwrate; | 1226 | store->last_frag_rate = tx.last_frag_rate; |
1192 | store->last_frag_rate = tx.u.tx.last_frag_rate; | ||
1193 | store->last_frag_rate_ctrl_probe = | 1227 | store->last_frag_rate_ctrl_probe = |
1194 | !!(tx.flags & IEEE80211_TXRXD_TXPROBE_LAST_FRAG); | 1228 | !!(tx.flags & IEEE80211_TX_PROBE_LAST_FRAG); |
1195 | } | 1229 | } |
1196 | rcu_read_unlock(); | 1230 | rcu_read_unlock(); |
1197 | return 0; | 1231 | return 0; |
@@ -1199,10 +1233,10 @@ retry: | |||
1199 | drop: | 1233 | drop: |
1200 | if (skb) | 1234 | if (skb) |
1201 | dev_kfree_skb(skb); | 1235 | dev_kfree_skb(skb); |
1202 | for (i = 0; i < tx.u.tx.num_extra_frag; i++) | 1236 | for (i = 0; i < tx.num_extra_frag; i++) |
1203 | if (tx.u.tx.extra_frag[i]) | 1237 | if (tx.extra_frag[i]) |
1204 | dev_kfree_skb(tx.u.tx.extra_frag[i]); | 1238 | dev_kfree_skb(tx.extra_frag[i]); |
1205 | kfree(tx.u.tx.extra_frag); | 1239 | kfree(tx.extra_frag); |
1206 | rcu_read_unlock(); | 1240 | rcu_read_unlock(); |
1207 | return 0; | 1241 | return 0; |
1208 | } | 1242 | } |
@@ -1260,6 +1294,8 @@ int ieee80211_master_start_xmit(struct sk_buff *skb, | |||
1260 | control.flags |= IEEE80211_TXCTL_REQUEUE; | 1294 | control.flags |= IEEE80211_TXCTL_REQUEUE; |
1261 | if (pkt_data->flags & IEEE80211_TXPD_EAPOL_FRAME) | 1295 | if (pkt_data->flags & IEEE80211_TXPD_EAPOL_FRAME) |
1262 | control.flags |= IEEE80211_TXCTL_EAPOL_FRAME; | 1296 | control.flags |= IEEE80211_TXCTL_EAPOL_FRAME; |
1297 | if (pkt_data->flags & IEEE80211_TXPD_AMPDU) | ||
1298 | control.flags |= IEEE80211_TXCTL_AMPDU; | ||
1263 | control.queue = pkt_data->queue; | 1299 | control.queue = pkt_data->queue; |
1264 | 1300 | ||
1265 | ret = ieee80211_tx(odev, skb, &control); | 1301 | ret = ieee80211_tx(odev, skb, &control); |
@@ -1346,8 +1382,9 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1346 | struct ieee80211_tx_packet_data *pkt_data; | 1382 | struct ieee80211_tx_packet_data *pkt_data; |
1347 | struct ieee80211_sub_if_data *sdata; | 1383 | struct ieee80211_sub_if_data *sdata; |
1348 | int ret = 1, head_need; | 1384 | int ret = 1, head_need; |
1349 | u16 ethertype, hdrlen, fc; | 1385 | u16 ethertype, hdrlen, meshhdrlen = 0, fc; |
1350 | struct ieee80211_hdr hdr; | 1386 | struct ieee80211_hdr hdr; |
1387 | struct ieee80211s_hdr mesh_hdr; | ||
1351 | const u8 *encaps_data; | 1388 | const u8 *encaps_data; |
1352 | int encaps_len, skip_header_bytes; | 1389 | int encaps_len, skip_header_bytes; |
1353 | int nh_pos, h_pos; | 1390 | int nh_pos, h_pos; |
@@ -1389,6 +1426,37 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1389 | memcpy(hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); | 1426 | memcpy(hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); |
1390 | hdrlen = 30; | 1427 | hdrlen = 30; |
1391 | break; | 1428 | break; |
1429 | #ifdef CONFIG_MAC80211_MESH | ||
1430 | case IEEE80211_IF_TYPE_MESH_POINT: | ||
1431 | fc |= IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS; | ||
1432 | /* RA TA DA SA */ | ||
1433 | if (is_multicast_ether_addr(skb->data)) | ||
1434 | memcpy(hdr.addr1, skb->data, ETH_ALEN); | ||
1435 | else if (mesh_nexthop_lookup(hdr.addr1, skb, dev)) | ||
1436 | return 0; | ||
1437 | memcpy(hdr.addr2, dev->dev_addr, ETH_ALEN); | ||
1438 | memcpy(hdr.addr3, skb->data, ETH_ALEN); | ||
1439 | memcpy(hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); | ||
1440 | if (skb->pkt_type == PACKET_OTHERHOST) { | ||
1441 | /* Forwarded frame, keep mesh ttl and seqnum */ | ||
1442 | struct ieee80211s_hdr *prev_meshhdr; | ||
1443 | prev_meshhdr = ((struct ieee80211s_hdr *)skb->cb); | ||
1444 | meshhdrlen = ieee80211_get_mesh_hdrlen(prev_meshhdr); | ||
1445 | memcpy(&mesh_hdr, prev_meshhdr, meshhdrlen); | ||
1446 | sdata->u.sta.mshstats.fwded_frames++; | ||
1447 | } else { | ||
1448 | if (!sdata->u.sta.mshcfg.dot11MeshTTL) { | ||
1449 | /* Do not send frames with mesh_ttl == 0 */ | ||
1450 | sdata->u.sta.mshstats.dropped_frames_ttl++; | ||
1451 | ret = 0; | ||
1452 | goto fail; | ||
1453 | } | ||
1454 | meshhdrlen = ieee80211_new_mesh_header(&mesh_hdr, | ||
1455 | sdata); | ||
1456 | } | ||
1457 | hdrlen = 30; | ||
1458 | break; | ||
1459 | #endif | ||
1392 | case IEEE80211_IF_TYPE_STA: | 1460 | case IEEE80211_IF_TYPE_STA: |
1393 | fc |= IEEE80211_FCTL_TODS; | 1461 | fc |= IEEE80211_FCTL_TODS; |
1394 | /* BSSID SA DA */ | 1462 | /* BSSID SA DA */ |
@@ -1409,10 +1477,17 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1409 | goto fail; | 1477 | goto fail; |
1410 | } | 1478 | } |
1411 | 1479 | ||
1412 | sta = sta_info_get(local, hdr.addr1); | 1480 | /* |
1413 | if (sta) { | 1481 | * There's no need to try to look up the destination |
1414 | sta_flags = sta->flags; | 1482 | * if it is a multicast address (which can only happen |
1415 | sta_info_put(sta); | 1483 | * in AP mode) |
1484 | */ | ||
1485 | if (!is_multicast_ether_addr(hdr.addr1)) { | ||
1486 | rcu_read_lock(); | ||
1487 | sta = sta_info_get(local, hdr.addr1); | ||
1488 | if (sta) | ||
1489 | sta_flags = sta->flags; | ||
1490 | rcu_read_unlock(); | ||
1416 | } | 1491 | } |
1417 | 1492 | ||
1418 | /* receiver is QoS enabled, use a QoS type frame */ | 1493 | /* receiver is QoS enabled, use a QoS type frame */ |
@@ -1422,12 +1497,12 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1422 | } | 1497 | } |
1423 | 1498 | ||
1424 | /* | 1499 | /* |
1425 | * If port access control is enabled, drop frames to unauthorised | 1500 | * Drop unicast frames to unauthorised stations unless they are |
1426 | * stations unless they are EAPOL frames from the local station. | 1501 | * EAPOL frames from the local station. |
1427 | */ | 1502 | */ |
1428 | if (unlikely(sdata->ieee802_1x_pac && | 1503 | if (unlikely(!is_multicast_ether_addr(hdr.addr1) && |
1429 | !(sta_flags & WLAN_STA_AUTHORIZED) && | 1504 | !(sta_flags & WLAN_STA_AUTHORIZED) && |
1430 | !(ethertype == ETH_P_PAE && | 1505 | !(ethertype == ETH_P_PAE && |
1431 | compare_ether_addr(dev->dev_addr, | 1506 | compare_ether_addr(dev->dev_addr, |
1432 | skb->data + ETH_ALEN) == 0))) { | 1507 | skb->data + ETH_ALEN) == 0))) { |
1433 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 1508 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
@@ -1480,7 +1555,7 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1480 | * build in headroom in __dev_alloc_skb() (linux/skbuff.h) and | 1555 | * build in headroom in __dev_alloc_skb() (linux/skbuff.h) and |
1481 | * alloc_skb() (net/core/skbuff.c) | 1556 | * alloc_skb() (net/core/skbuff.c) |
1482 | */ | 1557 | */ |
1483 | head_need = hdrlen + encaps_len + local->tx_headroom; | 1558 | head_need = hdrlen + encaps_len + meshhdrlen + local->tx_headroom; |
1484 | head_need -= skb_headroom(skb); | 1559 | head_need -= skb_headroom(skb); |
1485 | 1560 | ||
1486 | /* We are going to modify skb data, so make a copy of it if happens to | 1561 | /* We are going to modify skb data, so make a copy of it if happens to |
@@ -1514,6 +1589,12 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1514 | h_pos += encaps_len; | 1589 | h_pos += encaps_len; |
1515 | } | 1590 | } |
1516 | 1591 | ||
1592 | if (meshhdrlen > 0) { | ||
1593 | memcpy(skb_push(skb, meshhdrlen), &mesh_hdr, meshhdrlen); | ||
1594 | nh_pos += meshhdrlen; | ||
1595 | h_pos += meshhdrlen; | ||
1596 | } | ||
1597 | |||
1517 | if (fc & IEEE80211_STYPE_QOS_DATA) { | 1598 | if (fc & IEEE80211_STYPE_QOS_DATA) { |
1518 | __le16 *qos_control; | 1599 | __le16 *qos_control; |
1519 | 1600 | ||
@@ -1583,7 +1664,7 @@ void ieee80211_tx_pending(unsigned long data) | |||
1583 | struct ieee80211_local *local = (struct ieee80211_local *)data; | 1664 | struct ieee80211_local *local = (struct ieee80211_local *)data; |
1584 | struct net_device *dev = local->mdev; | 1665 | struct net_device *dev = local->mdev; |
1585 | struct ieee80211_tx_stored_packet *store; | 1666 | struct ieee80211_tx_stored_packet *store; |
1586 | struct ieee80211_txrx_data tx; | 1667 | struct ieee80211_tx_data tx; |
1587 | int i, ret, reschedule = 0; | 1668 | int i, ret, reschedule = 0; |
1588 | 1669 | ||
1589 | netif_tx_lock_bh(dev); | 1670 | netif_tx_lock_bh(dev); |
@@ -1595,14 +1676,13 @@ void ieee80211_tx_pending(unsigned long data) | |||
1595 | continue; | 1676 | continue; |
1596 | } | 1677 | } |
1597 | store = &local->pending_packet[i]; | 1678 | store = &local->pending_packet[i]; |
1598 | tx.u.tx.control = &store->control; | 1679 | tx.control = &store->control; |
1599 | tx.u.tx.extra_frag = store->extra_frag; | 1680 | tx.extra_frag = store->extra_frag; |
1600 | tx.u.tx.num_extra_frag = store->num_extra_frag; | 1681 | tx.num_extra_frag = store->num_extra_frag; |
1601 | tx.u.tx.last_frag_hwrate = store->last_frag_hwrate; | 1682 | tx.last_frag_rate = store->last_frag_rate; |
1602 | tx.u.tx.last_frag_rate = store->last_frag_rate; | ||
1603 | tx.flags = 0; | 1683 | tx.flags = 0; |
1604 | if (store->last_frag_rate_ctrl_probe) | 1684 | if (store->last_frag_rate_ctrl_probe) |
1605 | tx.flags |= IEEE80211_TXRXD_TXPROBE_LAST_FRAG; | 1685 | tx.flags |= IEEE80211_TX_PROBE_LAST_FRAG; |
1606 | ret = __ieee80211_tx(local, store->skb, &tx); | 1686 | ret = __ieee80211_tx(local, store->skb, &tx); |
1607 | if (ret) { | 1687 | if (ret) { |
1608 | if (ret == IEEE80211_TX_FRAG_AGAIN) | 1688 | if (ret == IEEE80211_TX_FRAG_AGAIN) |
@@ -1636,7 +1716,6 @@ static void ieee80211_beacon_add_tim(struct ieee80211_local *local, | |||
1636 | 1716 | ||
1637 | /* Generate bitmap for TIM only if there are any STAs in power save | 1717 | /* Generate bitmap for TIM only if there are any STAs in power save |
1638 | * mode. */ | 1718 | * mode. */ |
1639 | read_lock_bh(&local->sta_lock); | ||
1640 | if (atomic_read(&bss->num_sta_ps) > 0) | 1719 | if (atomic_read(&bss->num_sta_ps) > 0) |
1641 | /* in the hope that this is faster than | 1720 | /* in the hope that this is faster than |
1642 | * checking byte-for-byte */ | 1721 | * checking byte-for-byte */ |
@@ -1687,7 +1766,6 @@ static void ieee80211_beacon_add_tim(struct ieee80211_local *local, | |||
1687 | *pos++ = aid0; /* Bitmap control */ | 1766 | *pos++ = aid0; /* Bitmap control */ |
1688 | *pos++ = 0; /* Part Virt Bitmap */ | 1767 | *pos++ = 0; /* Part Virt Bitmap */ |
1689 | } | 1768 | } |
1690 | read_unlock_bh(&local->sta_lock); | ||
1691 | } | 1769 | } |
1692 | 1770 | ||
1693 | struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | 1771 | struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, |
@@ -1701,16 +1779,96 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | |||
1701 | struct ieee80211_if_ap *ap = NULL; | 1779 | struct ieee80211_if_ap *ap = NULL; |
1702 | struct rate_selection rsel; | 1780 | struct rate_selection rsel; |
1703 | struct beacon_data *beacon; | 1781 | struct beacon_data *beacon; |
1782 | struct ieee80211_supported_band *sband; | ||
1783 | struct ieee80211_mgmt *mgmt; | ||
1784 | int *num_beacons; | ||
1785 | bool err = true; | ||
1786 | u8 *pos; | ||
1787 | |||
1788 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | ||
1704 | 1789 | ||
1705 | rcu_read_lock(); | 1790 | rcu_read_lock(); |
1706 | 1791 | ||
1707 | sdata = vif_to_sdata(vif); | 1792 | sdata = vif_to_sdata(vif); |
1708 | bdev = sdata->dev; | 1793 | bdev = sdata->dev; |
1709 | ap = &sdata->u.ap; | ||
1710 | 1794 | ||
1711 | beacon = rcu_dereference(ap->beacon); | 1795 | if (sdata->vif.type == IEEE80211_IF_TYPE_AP) { |
1796 | ap = &sdata->u.ap; | ||
1797 | beacon = rcu_dereference(ap->beacon); | ||
1798 | if (ap && beacon) { | ||
1799 | /* | ||
1800 | * headroom, head length, | ||
1801 | * tail length and maximum TIM length | ||
1802 | */ | ||
1803 | skb = dev_alloc_skb(local->tx_headroom + | ||
1804 | beacon->head_len + | ||
1805 | beacon->tail_len + 256); | ||
1806 | if (!skb) | ||
1807 | goto out; | ||
1808 | |||
1809 | skb_reserve(skb, local->tx_headroom); | ||
1810 | memcpy(skb_put(skb, beacon->head_len), beacon->head, | ||
1811 | beacon->head_len); | ||
1812 | |||
1813 | ieee80211_include_sequence(sdata, | ||
1814 | (struct ieee80211_hdr *)skb->data); | ||
1815 | |||
1816 | /* | ||
1817 | * Not very nice, but we want to allow the driver to call | ||
1818 | * ieee80211_beacon_get() as a response to the set_tim() | ||
1819 | * callback. That, however, is already invoked under the | ||
1820 | * sta_lock to guarantee consistent and race-free update | ||
1821 | * of the tim bitmap in mac80211 and the driver. | ||
1822 | */ | ||
1823 | if (local->tim_in_locked_section) { | ||
1824 | ieee80211_beacon_add_tim(local, ap, skb, beacon); | ||
1825 | } else { | ||
1826 | unsigned long flags; | ||
1827 | |||
1828 | spin_lock_irqsave(&local->sta_lock, flags); | ||
1829 | ieee80211_beacon_add_tim(local, ap, skb, beacon); | ||
1830 | spin_unlock_irqrestore(&local->sta_lock, flags); | ||
1831 | } | ||
1832 | |||
1833 | if (beacon->tail) | ||
1834 | memcpy(skb_put(skb, beacon->tail_len), | ||
1835 | beacon->tail, beacon->tail_len); | ||
1712 | 1836 | ||
1713 | if (!ap || sdata->vif.type != IEEE80211_IF_TYPE_AP || !beacon) { | 1837 | num_beacons = &ap->num_beacons; |
1838 | |||
1839 | err = false; | ||
1840 | } | ||
1841 | } else if (ieee80211_vif_is_mesh(&sdata->vif)) { | ||
1842 | /* headroom, head length, tail length and maximum TIM length */ | ||
1843 | skb = dev_alloc_skb(local->tx_headroom + 400); | ||
1844 | if (!skb) | ||
1845 | goto out; | ||
1846 | |||
1847 | skb_reserve(skb, local->hw.extra_tx_headroom); | ||
1848 | mgmt = (struct ieee80211_mgmt *) | ||
1849 | skb_put(skb, 24 + sizeof(mgmt->u.beacon)); | ||
1850 | memset(mgmt, 0, 24 + sizeof(mgmt->u.beacon)); | ||
1851 | mgmt->frame_control = IEEE80211_FC(IEEE80211_FTYPE_MGMT, | ||
1852 | IEEE80211_STYPE_BEACON); | ||
1853 | memset(mgmt->da, 0xff, ETH_ALEN); | ||
1854 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); | ||
1855 | /* BSSID is left zeroed, wildcard value */ | ||
1856 | mgmt->u.beacon.beacon_int = | ||
1857 | cpu_to_le16(local->hw.conf.beacon_int); | ||
1858 | mgmt->u.beacon.capab_info = 0x0; /* 0x0 for MPs */ | ||
1859 | |||
1860 | pos = skb_put(skb, 2); | ||
1861 | *pos++ = WLAN_EID_SSID; | ||
1862 | *pos++ = 0x0; | ||
1863 | |||
1864 | mesh_mgmt_ies_add(skb, sdata->dev); | ||
1865 | |||
1866 | num_beacons = &sdata->u.sta.num_beacons; | ||
1867 | |||
1868 | err = false; | ||
1869 | } | ||
1870 | |||
1871 | if (err) { | ||
1714 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 1872 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
1715 | if (net_ratelimit()) | 1873 | if (net_ratelimit()) |
1716 | printk(KERN_DEBUG "no beacon data avail for %s\n", | 1874 | printk(KERN_DEBUG "no beacon data avail for %s\n", |
@@ -1720,27 +1878,8 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | |||
1720 | goto out; | 1878 | goto out; |
1721 | } | 1879 | } |
1722 | 1880 | ||
1723 | /* headroom, head length, tail length and maximum TIM length */ | ||
1724 | skb = dev_alloc_skb(local->tx_headroom + beacon->head_len + | ||
1725 | beacon->tail_len + 256); | ||
1726 | if (!skb) | ||
1727 | goto out; | ||
1728 | |||
1729 | skb_reserve(skb, local->tx_headroom); | ||
1730 | memcpy(skb_put(skb, beacon->head_len), beacon->head, | ||
1731 | beacon->head_len); | ||
1732 | |||
1733 | ieee80211_include_sequence(sdata, (struct ieee80211_hdr *)skb->data); | ||
1734 | |||
1735 | ieee80211_beacon_add_tim(local, ap, skb, beacon); | ||
1736 | |||
1737 | if (beacon->tail) | ||
1738 | memcpy(skb_put(skb, beacon->tail_len), beacon->tail, | ||
1739 | beacon->tail_len); | ||
1740 | |||
1741 | if (control) { | 1881 | if (control) { |
1742 | rate_control_get_rate(local->mdev, local->oper_hw_mode, skb, | 1882 | rate_control_get_rate(local->mdev, sband, skb, &rsel); |
1743 | &rsel); | ||
1744 | if (!rsel.rate) { | 1883 | if (!rsel.rate) { |
1745 | if (net_ratelimit()) { | 1884 | if (net_ratelimit()) { |
1746 | printk(KERN_DEBUG "%s: ieee80211_beacon_get: " | 1885 | printk(KERN_DEBUG "%s: ieee80211_beacon_get: " |
@@ -1753,20 +1892,17 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | |||
1753 | } | 1892 | } |
1754 | 1893 | ||
1755 | control->vif = vif; | 1894 | control->vif = vif; |
1756 | control->tx_rate = | 1895 | control->tx_rate = rsel.rate; |
1757 | (sdata->bss_conf.use_short_preamble && | 1896 | if (sdata->bss_conf.use_short_preamble && |
1758 | (rsel.rate->flags & IEEE80211_RATE_PREAMBLE2)) ? | 1897 | rsel.rate->flags & IEEE80211_RATE_SHORT_PREAMBLE) |
1759 | rsel.rate->val2 : rsel.rate->val; | 1898 | control->flags |= IEEE80211_TXCTL_SHORT_PREAMBLE; |
1760 | control->antenna_sel_tx = local->hw.conf.antenna_sel_tx; | 1899 | control->antenna_sel_tx = local->hw.conf.antenna_sel_tx; |
1761 | control->power_level = local->hw.conf.power_level; | ||
1762 | control->flags |= IEEE80211_TXCTL_NO_ACK; | 1900 | control->flags |= IEEE80211_TXCTL_NO_ACK; |
1763 | control->retry_limit = 1; | 1901 | control->retry_limit = 1; |
1764 | control->flags |= IEEE80211_TXCTL_CLEAR_DST_MASK; | 1902 | control->flags |= IEEE80211_TXCTL_CLEAR_PS_FILT; |
1765 | } | 1903 | } |
1766 | 1904 | (*num_beacons)++; | |
1767 | ap->num_beacons++; | 1905 | out: |
1768 | |||
1769 | out: | ||
1770 | rcu_read_unlock(); | 1906 | rcu_read_unlock(); |
1771 | return skb; | 1907 | return skb; |
1772 | } | 1908 | } |
@@ -1814,8 +1950,8 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw, | |||
1814 | struct sk_buff *skb; | 1950 | struct sk_buff *skb; |
1815 | struct sta_info *sta; | 1951 | struct sta_info *sta; |
1816 | ieee80211_tx_handler *handler; | 1952 | ieee80211_tx_handler *handler; |
1817 | struct ieee80211_txrx_data tx; | 1953 | struct ieee80211_tx_data tx; |
1818 | ieee80211_txrx_result res = TXRX_DROP; | 1954 | ieee80211_tx_result res = TX_DROP; |
1819 | struct net_device *bdev; | 1955 | struct net_device *bdev; |
1820 | struct ieee80211_sub_if_data *sdata; | 1956 | struct ieee80211_sub_if_data *sdata; |
1821 | struct ieee80211_if_ap *bss = NULL; | 1957 | struct ieee80211_if_ap *bss = NULL; |
@@ -1836,7 +1972,6 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw, | |||
1836 | rcu_read_unlock(); | 1972 | rcu_read_unlock(); |
1837 | return NULL; | 1973 | return NULL; |
1838 | } | 1974 | } |
1839 | rcu_read_unlock(); | ||
1840 | 1975 | ||
1841 | if (bss->dtim_count != 0) | 1976 | if (bss->dtim_count != 0) |
1842 | return NULL; /* send buffered bc/mc only after DTIM beacon */ | 1977 | return NULL; /* send buffered bc/mc only after DTIM beacon */ |
@@ -1862,27 +1997,26 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw, | |||
1862 | dev_kfree_skb_any(skb); | 1997 | dev_kfree_skb_any(skb); |
1863 | } | 1998 | } |
1864 | sta = tx.sta; | 1999 | sta = tx.sta; |
1865 | tx.flags |= IEEE80211_TXRXD_TXPS_BUFFERED; | 2000 | tx.flags |= IEEE80211_TX_PS_BUFFERED; |
1866 | tx.u.tx.mode = local->hw.conf.mode; | 2001 | tx.channel = local->hw.conf.channel; |
1867 | 2002 | ||
1868 | for (handler = local->tx_handlers; *handler != NULL; handler++) { | 2003 | for (handler = ieee80211_tx_handlers; *handler != NULL; handler++) { |
1869 | res = (*handler)(&tx); | 2004 | res = (*handler)(&tx); |
1870 | if (res == TXRX_DROP || res == TXRX_QUEUED) | 2005 | if (res == TX_DROP || res == TX_QUEUED) |
1871 | break; | 2006 | break; |
1872 | } | 2007 | } |
1873 | skb = tx.skb; /* handlers are allowed to change skb */ | 2008 | skb = tx.skb; /* handlers are allowed to change skb */ |
1874 | 2009 | ||
1875 | if (res == TXRX_DROP) { | 2010 | if (res == TX_DROP) { |
1876 | I802_DEBUG_INC(local->tx_handlers_drop); | 2011 | I802_DEBUG_INC(local->tx_handlers_drop); |
1877 | dev_kfree_skb(skb); | 2012 | dev_kfree_skb(skb); |
1878 | skb = NULL; | 2013 | skb = NULL; |
1879 | } else if (res == TXRX_QUEUED) { | 2014 | } else if (res == TX_QUEUED) { |
1880 | I802_DEBUG_INC(local->tx_handlers_queued); | 2015 | I802_DEBUG_INC(local->tx_handlers_queued); |
1881 | skb = NULL; | 2016 | skb = NULL; |
1882 | } | 2017 | } |
1883 | 2018 | ||
1884 | if (sta) | 2019 | rcu_read_unlock(); |
1885 | sta_info_put(sta); | ||
1886 | 2020 | ||
1887 | return skb; | 2021 | return skb; |
1888 | } | 2022 | } |