aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/rx.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/rx.c')
-rw-r--r--net/mac80211/rx.c163
1 files changed, 82 insertions, 81 deletions
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 1ff1301ca3df..2e65ca1cd1aa 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -251,7 +251,7 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb,
251} 251}
252 252
253 253
254static void ieee80211_parse_qos(struct ieee80211_txrx_data *rx) 254static void ieee80211_parse_qos(struct ieee80211_rx_data *rx)
255{ 255{
256 u8 *data = rx->skb->data; 256 u8 *data = rx->skb->data;
257 int tid; 257 int tid;
@@ -262,9 +262,9 @@ static void ieee80211_parse_qos(struct ieee80211_txrx_data *rx)
262 /* frame has qos control */ 262 /* frame has qos control */
263 tid = qc[0] & QOS_CONTROL_TID_MASK; 263 tid = qc[0] & QOS_CONTROL_TID_MASK;
264 if (qc[0] & IEEE80211_QOS_CONTROL_A_MSDU_PRESENT) 264 if (qc[0] & IEEE80211_QOS_CONTROL_A_MSDU_PRESENT)
265 rx->flags |= IEEE80211_TXRXD_RX_AMSDU; 265 rx->flags |= IEEE80211_RX_AMSDU;
266 else 266 else
267 rx->flags &= ~IEEE80211_TXRXD_RX_AMSDU; 267 rx->flags &= ~IEEE80211_RX_AMSDU;
268 } else { 268 } else {
269 if (unlikely((rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT)) { 269 if (unlikely((rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT)) {
270 /* Separate TID for management frames */ 270 /* Separate TID for management frames */
@@ -280,13 +280,13 @@ static void ieee80211_parse_qos(struct ieee80211_txrx_data *rx)
280 if (rx->sta) 280 if (rx->sta)
281 I802_DEBUG_INC(rx->sta->wme_rx_queue[tid]); 281 I802_DEBUG_INC(rx->sta->wme_rx_queue[tid]);
282 282
283 rx->u.rx.queue = tid; 283 rx->queue = tid;
284 /* Set skb->priority to 1d tag if highest order bit of TID is not set. 284 /* Set skb->priority to 1d tag if highest order bit of TID is not set.
285 * For now, set skb->priority to 0 for other cases. */ 285 * For now, set skb->priority to 0 for other cases. */
286 rx->skb->priority = (tid > 7) ? 0 : tid; 286 rx->skb->priority = (tid > 7) ? 0 : tid;
287} 287}
288 288
289static void ieee80211_verify_ip_alignment(struct ieee80211_txrx_data *rx) 289static void ieee80211_verify_ip_alignment(struct ieee80211_rx_data *rx)
290{ 290{
291#ifdef CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT 291#ifdef CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT
292 int hdrlen; 292 int hdrlen;
@@ -314,7 +314,7 @@ static void ieee80211_verify_ip_alignment(struct ieee80211_txrx_data *rx)
314 * to move the 802.11 header further back in that case. 314 * to move the 802.11 header further back in that case.
315 */ 315 */
316 hdrlen = ieee80211_get_hdrlen(rx->fc); 316 hdrlen = ieee80211_get_hdrlen(rx->fc);
317 if (rx->flags & IEEE80211_TXRXD_RX_AMSDU) 317 if (rx->flags & IEEE80211_RX_AMSDU)
318 hdrlen += ETH_HLEN; 318 hdrlen += ETH_HLEN;
319 WARN_ON_ONCE(((unsigned long)(rx->skb->data + hdrlen)) & 3); 319 WARN_ON_ONCE(((unsigned long)(rx->skb->data + hdrlen)) & 3);
320#endif 320#endif
@@ -357,32 +357,32 @@ static u32 ieee80211_rx_load_stats(struct ieee80211_local *local,
357/* rx handlers */ 357/* rx handlers */
358 358
359static ieee80211_rx_result 359static ieee80211_rx_result
360ieee80211_rx_h_if_stats(struct ieee80211_txrx_data *rx) 360ieee80211_rx_h_if_stats(struct ieee80211_rx_data *rx)
361{ 361{
362 if (rx->sta) 362 if (rx->sta)
363 rx->sta->channel_use_raw += rx->u.rx.load; 363 rx->sta->channel_use_raw += rx->load;
364 rx->sdata->channel_use_raw += rx->u.rx.load; 364 rx->sdata->channel_use_raw += rx->load;
365 return RX_CONTINUE; 365 return RX_CONTINUE;
366} 366}
367 367
368static ieee80211_rx_result 368static ieee80211_rx_result
369ieee80211_rx_h_passive_scan(struct ieee80211_txrx_data *rx) 369ieee80211_rx_h_passive_scan(struct ieee80211_rx_data *rx)
370{ 370{
371 struct ieee80211_local *local = rx->local; 371 struct ieee80211_local *local = rx->local;
372 struct sk_buff *skb = rx->skb; 372 struct sk_buff *skb = rx->skb;
373 373
374 if (unlikely(local->sta_hw_scanning)) 374 if (unlikely(local->sta_hw_scanning))
375 return ieee80211_sta_rx_scan(rx->dev, skb, rx->u.rx.status); 375 return ieee80211_sta_rx_scan(rx->dev, skb, rx->status);
376 376
377 if (unlikely(local->sta_sw_scanning)) { 377 if (unlikely(local->sta_sw_scanning)) {
378 /* drop all the other packets during a software scan anyway */ 378 /* drop all the other packets during a software scan anyway */
379 if (ieee80211_sta_rx_scan(rx->dev, skb, rx->u.rx.status) 379 if (ieee80211_sta_rx_scan(rx->dev, skb, rx->status)
380 != RX_QUEUED) 380 != RX_QUEUED)
381 dev_kfree_skb(skb); 381 dev_kfree_skb(skb);
382 return RX_QUEUED; 382 return RX_QUEUED;
383 } 383 }
384 384
385 if (unlikely(rx->flags & IEEE80211_TXRXD_RXIN_SCAN)) { 385 if (unlikely(rx->flags & IEEE80211_RX_IN_SCAN)) {
386 /* scanning finished during invoking of handlers */ 386 /* scanning finished during invoking of handlers */
387 I802_DEBUG_INC(local->rx_handlers_drop_passive_scan); 387 I802_DEBUG_INC(local->rx_handlers_drop_passive_scan);
388 return RX_DROP_UNUSABLE; 388 return RX_DROP_UNUSABLE;
@@ -392,7 +392,7 @@ ieee80211_rx_h_passive_scan(struct ieee80211_txrx_data *rx)
392} 392}
393 393
394static ieee80211_rx_result 394static ieee80211_rx_result
395ieee80211_rx_mesh_check(struct ieee80211_txrx_data *rx) 395ieee80211_rx_mesh_check(struct ieee80211_rx_data *rx)
396{ 396{
397 int hdrlen = ieee80211_get_hdrlen(rx->fc); 397 int hdrlen = ieee80211_get_hdrlen(rx->fc);
398 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) rx->skb->data; 398 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) rx->skb->data;
@@ -443,7 +443,7 @@ ieee80211_rx_mesh_check(struct ieee80211_txrx_data *rx)
443 443
444 444
445static ieee80211_rx_result 445static ieee80211_rx_result
446ieee80211_rx_h_check(struct ieee80211_txrx_data *rx) 446ieee80211_rx_h_check(struct ieee80211_rx_data *rx)
447{ 447{
448 struct ieee80211_hdr *hdr; 448 struct ieee80211_hdr *hdr;
449 449
@@ -452,15 +452,15 @@ ieee80211_rx_h_check(struct ieee80211_txrx_data *rx)
452 /* Drop duplicate 802.11 retransmissions (IEEE 802.11 Chap. 9.2.9) */ 452 /* Drop duplicate 802.11 retransmissions (IEEE 802.11 Chap. 9.2.9) */
453 if (rx->sta && !is_multicast_ether_addr(hdr->addr1)) { 453 if (rx->sta && !is_multicast_ether_addr(hdr->addr1)) {
454 if (unlikely(rx->fc & IEEE80211_FCTL_RETRY && 454 if (unlikely(rx->fc & IEEE80211_FCTL_RETRY &&
455 rx->sta->last_seq_ctrl[rx->u.rx.queue] == 455 rx->sta->last_seq_ctrl[rx->queue] ==
456 hdr->seq_ctrl)) { 456 hdr->seq_ctrl)) {
457 if (rx->flags & IEEE80211_TXRXD_RXRA_MATCH) { 457 if (rx->flags & IEEE80211_RX_RA_MATCH) {
458 rx->local->dot11FrameDuplicateCount++; 458 rx->local->dot11FrameDuplicateCount++;
459 rx->sta->num_duplicates++; 459 rx->sta->num_duplicates++;
460 } 460 }
461 return RX_DROP_MONITOR; 461 return RX_DROP_MONITOR;
462 } else 462 } else
463 rx->sta->last_seq_ctrl[rx->u.rx.queue] = hdr->seq_ctrl; 463 rx->sta->last_seq_ctrl[rx->queue] = hdr->seq_ctrl;
464 } 464 }
465 465
466 if (unlikely(rx->skb->len < 16)) { 466 if (unlikely(rx->skb->len < 16)) {
@@ -488,7 +488,7 @@ ieee80211_rx_h_check(struct ieee80211_txrx_data *rx)
488 if ((!(rx->fc & IEEE80211_FCTL_FROMDS) && 488 if ((!(rx->fc & IEEE80211_FCTL_FROMDS) &&
489 !(rx->fc & IEEE80211_FCTL_TODS) && 489 !(rx->fc & IEEE80211_FCTL_TODS) &&
490 (rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) 490 (rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)
491 || !(rx->flags & IEEE80211_TXRXD_RXRA_MATCH)) { 491 || !(rx->flags & IEEE80211_RX_RA_MATCH)) {
492 /* Drop IBSS frames and frames for other hosts 492 /* Drop IBSS frames and frames for other hosts
493 * silently. */ 493 * silently. */
494 return RX_DROP_MONITOR; 494 return RX_DROP_MONITOR;
@@ -502,7 +502,7 @@ ieee80211_rx_h_check(struct ieee80211_txrx_data *rx)
502 502
503 503
504static ieee80211_rx_result 504static ieee80211_rx_result
505ieee80211_rx_h_decrypt(struct ieee80211_txrx_data *rx) 505ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx)
506{ 506{
507 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) rx->skb->data; 507 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) rx->skb->data;
508 int keyidx; 508 int keyidx;
@@ -543,7 +543,7 @@ ieee80211_rx_h_decrypt(struct ieee80211_txrx_data *rx)
543 * No point in finding a key and decrypting if the frame is neither 543 * No point in finding a key and decrypting if the frame is neither
544 * addressed to us nor a multicast frame. 544 * addressed to us nor a multicast frame.
545 */ 545 */
546 if (!(rx->flags & IEEE80211_TXRXD_RXRA_MATCH)) 546 if (!(rx->flags & IEEE80211_RX_RA_MATCH))
547 return RX_CONTINUE; 547 return RX_CONTINUE;
548 548
549 if (rx->sta) 549 if (rx->sta)
@@ -561,8 +561,8 @@ ieee80211_rx_h_decrypt(struct ieee80211_txrx_data *rx)
561 * we somehow allow the driver to tell us which key 561 * we somehow allow the driver to tell us which key
562 * the hardware used if this flag is set? 562 * the hardware used if this flag is set?
563 */ 563 */
564 if ((rx->u.rx.status->flag & RX_FLAG_DECRYPTED) && 564 if ((rx->status->flag & RX_FLAG_DECRYPTED) &&
565 (rx->u.rx.status->flag & RX_FLAG_IV_STRIPPED)) 565 (rx->status->flag & RX_FLAG_IV_STRIPPED))
566 return RX_CONTINUE; 566 return RX_CONTINUE;
567 567
568 hdrlen = ieee80211_get_hdrlen(rx->fc); 568 hdrlen = ieee80211_get_hdrlen(rx->fc);
@@ -603,8 +603,8 @@ ieee80211_rx_h_decrypt(struct ieee80211_txrx_data *rx)
603 /* Check for weak IVs if possible */ 603 /* Check for weak IVs if possible */
604 if (rx->sta && rx->key->conf.alg == ALG_WEP && 604 if (rx->sta && rx->key->conf.alg == ALG_WEP &&
605 ((rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) && 605 ((rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) &&
606 (!(rx->u.rx.status->flag & RX_FLAG_IV_STRIPPED) || 606 (!(rx->status->flag & RX_FLAG_IV_STRIPPED) ||
607 !(rx->u.rx.status->flag & RX_FLAG_DECRYPTED)) && 607 !(rx->status->flag & RX_FLAG_DECRYPTED)) &&
608 ieee80211_wep_is_weak_iv(rx->skb, rx->key)) 608 ieee80211_wep_is_weak_iv(rx->skb, rx->key))
609 rx->sta->wep_weak_iv_count++; 609 rx->sta->wep_weak_iv_count++;
610 610
@@ -621,7 +621,7 @@ ieee80211_rx_h_decrypt(struct ieee80211_txrx_data *rx)
621 } 621 }
622 622
623 /* either the frame has been decrypted or will be dropped */ 623 /* either the frame has been decrypted or will be dropped */
624 rx->u.rx.status->flag |= RX_FLAG_DECRYPTED; 624 rx->status->flag |= RX_FLAG_DECRYPTED;
625 625
626 return result; 626 return result;
627} 627}
@@ -691,7 +691,7 @@ static int ap_sta_ps_end(struct net_device *dev, struct sta_info *sta)
691} 691}
692 692
693static ieee80211_rx_result 693static ieee80211_rx_result
694ieee80211_rx_h_sta_process(struct ieee80211_txrx_data *rx) 694ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx)
695{ 695{
696 struct sta_info *sta = rx->sta; 696 struct sta_info *sta = rx->sta;
697 struct net_device *dev = rx->dev; 697 struct net_device *dev = rx->dev;
@@ -720,20 +720,20 @@ ieee80211_rx_h_sta_process(struct ieee80211_txrx_data *rx)
720 sta->last_rx = jiffies; 720 sta->last_rx = jiffies;
721 } 721 }
722 722
723 if (!(rx->flags & IEEE80211_TXRXD_RXRA_MATCH)) 723 if (!(rx->flags & IEEE80211_RX_RA_MATCH))
724 return RX_CONTINUE; 724 return RX_CONTINUE;
725 725
726 sta->rx_fragments++; 726 sta->rx_fragments++;
727 sta->rx_bytes += rx->skb->len; 727 sta->rx_bytes += rx->skb->len;
728 sta->last_rssi = rx->u.rx.status->ssi; 728 sta->last_rssi = rx->status->ssi;
729 sta->last_signal = rx->u.rx.status->signal; 729 sta->last_signal = rx->status->signal;
730 sta->last_noise = rx->u.rx.status->noise; 730 sta->last_noise = rx->status->noise;
731 731
732 if (!(rx->fc & IEEE80211_FCTL_MOREFRAGS)) { 732 if (!(rx->fc & IEEE80211_FCTL_MOREFRAGS)) {
733 /* Change STA power saving mode only in the end of a frame 733 /* Change STA power saving mode only in the end of a frame
734 * exchange sequence */ 734 * exchange sequence */
735 if ((sta->flags & WLAN_STA_PS) && !(rx->fc & IEEE80211_FCTL_PM)) 735 if ((sta->flags & WLAN_STA_PS) && !(rx->fc & IEEE80211_FCTL_PM))
736 rx->u.rx.sent_ps_buffered += ap_sta_ps_end(dev, sta); 736 rx->sent_ps_buffered += ap_sta_ps_end(dev, sta);
737 else if (!(sta->flags & WLAN_STA_PS) && 737 else if (!(sta->flags & WLAN_STA_PS) &&
738 (rx->fc & IEEE80211_FCTL_PM)) 738 (rx->fc & IEEE80211_FCTL_PM))
739 ap_sta_ps_start(dev, sta); 739 ap_sta_ps_start(dev, sta);
@@ -838,7 +838,7 @@ ieee80211_reassemble_find(struct ieee80211_sub_if_data *sdata,
838} 838}
839 839
840static ieee80211_rx_result 840static ieee80211_rx_result
841ieee80211_rx_h_defragment(struct ieee80211_txrx_data *rx) 841ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx)
842{ 842{
843 struct ieee80211_hdr *hdr; 843 struct ieee80211_hdr *hdr;
844 u16 sc; 844 u16 sc;
@@ -864,14 +864,14 @@ ieee80211_rx_h_defragment(struct ieee80211_txrx_data *rx)
864 if (frag == 0) { 864 if (frag == 0) {
865 /* This is the first fragment of a new frame. */ 865 /* This is the first fragment of a new frame. */
866 entry = ieee80211_reassemble_add(rx->sdata, frag, seq, 866 entry = ieee80211_reassemble_add(rx->sdata, frag, seq,
867 rx->u.rx.queue, &(rx->skb)); 867 rx->queue, &(rx->skb));
868 if (rx->key && rx->key->conf.alg == ALG_CCMP && 868 if (rx->key && rx->key->conf.alg == ALG_CCMP &&
869 (rx->fc & IEEE80211_FCTL_PROTECTED)) { 869 (rx->fc & IEEE80211_FCTL_PROTECTED)) {
870 /* Store CCMP PN so that we can verify that the next 870 /* Store CCMP PN so that we can verify that the next
871 * fragment has a sequential PN value. */ 871 * fragment has a sequential PN value. */
872 entry->ccmp = 1; 872 entry->ccmp = 1;
873 memcpy(entry->last_pn, 873 memcpy(entry->last_pn,
874 rx->key->u.ccmp.rx_pn[rx->u.rx.queue], 874 rx->key->u.ccmp.rx_pn[rx->queue],
875 CCMP_PN_LEN); 875 CCMP_PN_LEN);
876 } 876 }
877 return RX_QUEUED; 877 return RX_QUEUED;
@@ -881,7 +881,7 @@ ieee80211_rx_h_defragment(struct ieee80211_txrx_data *rx)
881 * fragment cache. Add this fragment to the end of the pending entry. 881 * fragment cache. Add this fragment to the end of the pending entry.
882 */ 882 */
883 entry = ieee80211_reassemble_find(rx->sdata, rx->fc, frag, seq, 883 entry = ieee80211_reassemble_find(rx->sdata, rx->fc, frag, seq,
884 rx->u.rx.queue, hdr); 884 rx->queue, hdr);
885 if (!entry) { 885 if (!entry) {
886 I802_DEBUG_INC(rx->local->rx_handlers_drop_defrag); 886 I802_DEBUG_INC(rx->local->rx_handlers_drop_defrag);
887 return RX_DROP_MONITOR; 887 return RX_DROP_MONITOR;
@@ -900,7 +900,7 @@ ieee80211_rx_h_defragment(struct ieee80211_txrx_data *rx)
900 if (pn[i]) 900 if (pn[i])
901 break; 901 break;
902 } 902 }
903 rpn = rx->key->u.ccmp.rx_pn[rx->u.rx.queue]; 903 rpn = rx->key->u.ccmp.rx_pn[rx->queue];
904 if (memcmp(pn, rpn, CCMP_PN_LEN) != 0) { 904 if (memcmp(pn, rpn, CCMP_PN_LEN) != 0) {
905 if (net_ratelimit()) 905 if (net_ratelimit())
906 printk(KERN_DEBUG "%s: defrag: CCMP PN not " 906 printk(KERN_DEBUG "%s: defrag: CCMP PN not "
@@ -941,7 +941,7 @@ ieee80211_rx_h_defragment(struct ieee80211_txrx_data *rx)
941 } 941 }
942 942
943 /* Complete frame has been reassembled - process it now */ 943 /* Complete frame has been reassembled - process it now */
944 rx->flags |= IEEE80211_TXRXD_FRAGMENTED; 944 rx->flags |= IEEE80211_RX_FRAGMENTED;
945 945
946 out: 946 out:
947 if (rx->sta) 947 if (rx->sta)
@@ -954,7 +954,7 @@ ieee80211_rx_h_defragment(struct ieee80211_txrx_data *rx)
954} 954}
955 955
956static ieee80211_rx_result 956static ieee80211_rx_result
957ieee80211_rx_h_ps_poll(struct ieee80211_txrx_data *rx) 957ieee80211_rx_h_ps_poll(struct ieee80211_rx_data *rx)
958{ 958{
959 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(rx->dev); 959 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(rx->dev);
960 struct sk_buff *skb; 960 struct sk_buff *skb;
@@ -964,7 +964,7 @@ ieee80211_rx_h_ps_poll(struct ieee80211_txrx_data *rx)
964 if (likely(!rx->sta || 964 if (likely(!rx->sta ||
965 (rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_CTL || 965 (rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_CTL ||
966 (rx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_PSPOLL || 966 (rx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_PSPOLL ||
967 !(rx->flags & IEEE80211_TXRXD_RXRA_MATCH))) 967 !(rx->flags & IEEE80211_RX_RA_MATCH)))
968 return RX_CONTINUE; 968 return RX_CONTINUE;
969 969
970 if ((sdata->vif.type != IEEE80211_IF_TYPE_AP) && 970 if ((sdata->vif.type != IEEE80211_IF_TYPE_AP) &&
@@ -1008,7 +1008,7 @@ ieee80211_rx_h_ps_poll(struct ieee80211_txrx_data *rx)
1008 if (no_pending_pkts) 1008 if (no_pending_pkts)
1009 sta_info_clear_tim_bit(rx->sta); 1009 sta_info_clear_tim_bit(rx->sta);
1010#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG 1010#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
1011 } else if (!rx->u.rx.sent_ps_buffered) { 1011 } else if (!rx->sent_ps_buffered) {
1012 /* 1012 /*
1013 * FIXME: This can be the result of a race condition between 1013 * FIXME: This can be the result of a race condition between
1014 * us expiring a frame and the station polling for it. 1014 * us expiring a frame and the station polling for it.
@@ -1029,7 +1029,7 @@ ieee80211_rx_h_ps_poll(struct ieee80211_txrx_data *rx)
1029} 1029}
1030 1030
1031static ieee80211_rx_result 1031static ieee80211_rx_result
1032ieee80211_rx_h_remove_qos_control(struct ieee80211_txrx_data *rx) 1032ieee80211_rx_h_remove_qos_control(struct ieee80211_rx_data *rx)
1033{ 1033{
1034 u16 fc = rx->fc; 1034 u16 fc = rx->fc;
1035 u8 *data = rx->skb->data; 1035 u8 *data = rx->skb->data;
@@ -1049,7 +1049,7 @@ ieee80211_rx_h_remove_qos_control(struct ieee80211_txrx_data *rx)
1049} 1049}
1050 1050
1051static int 1051static int
1052ieee80211_802_1x_port_control(struct ieee80211_txrx_data *rx) 1052ieee80211_802_1x_port_control(struct ieee80211_rx_data *rx)
1053{ 1053{
1054 if (unlikely(!rx->sta || !(rx->sta->flags & WLAN_STA_AUTHORIZED))) { 1054 if (unlikely(!rx->sta || !(rx->sta->flags & WLAN_STA_AUTHORIZED))) {
1055#ifdef CONFIG_MAC80211_DEBUG 1055#ifdef CONFIG_MAC80211_DEBUG
@@ -1064,13 +1064,13 @@ ieee80211_802_1x_port_control(struct ieee80211_txrx_data *rx)
1064} 1064}
1065 1065
1066static int 1066static int
1067ieee80211_drop_unencrypted(struct ieee80211_txrx_data *rx) 1067ieee80211_drop_unencrypted(struct ieee80211_rx_data *rx)
1068{ 1068{
1069 /* 1069 /*
1070 * Pass through unencrypted frames if the hardware has 1070 * Pass through unencrypted frames if the hardware has
1071 * decrypted them already. 1071 * decrypted them already.
1072 */ 1072 */
1073 if (rx->u.rx.status->flag & RX_FLAG_DECRYPTED) 1073 if (rx->status->flag & RX_FLAG_DECRYPTED)
1074 return 0; 1074 return 0;
1075 1075
1076 /* Drop unencrypted frames if key is set. */ 1076 /* Drop unencrypted frames if key is set. */
@@ -1087,7 +1087,7 @@ ieee80211_drop_unencrypted(struct ieee80211_txrx_data *rx)
1087} 1087}
1088 1088
1089static int 1089static int
1090ieee80211_data_to_8023(struct ieee80211_txrx_data *rx) 1090ieee80211_data_to_8023(struct ieee80211_rx_data *rx)
1091{ 1091{
1092 struct net_device *dev = rx->dev; 1092 struct net_device *dev = rx->dev;
1093 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) rx->skb->data; 1093 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) rx->skb->data;
@@ -1235,7 +1235,7 @@ ieee80211_data_to_8023(struct ieee80211_txrx_data *rx)
1235/* 1235/*
1236 * requires that rx->skb is a frame with ethernet header 1236 * requires that rx->skb is a frame with ethernet header
1237 */ 1237 */
1238static bool ieee80211_frame_allowed(struct ieee80211_txrx_data *rx) 1238static bool ieee80211_frame_allowed(struct ieee80211_rx_data *rx)
1239{ 1239{
1240 static const u8 pae_group_addr[ETH_ALEN] 1240 static const u8 pae_group_addr[ETH_ALEN]
1241 = { 0x01, 0x80, 0xC2, 0x00, 0x00, 0x03 }; 1241 = { 0x01, 0x80, 0xC2, 0x00, 0x00, 0x03 };
@@ -1261,7 +1261,7 @@ static bool ieee80211_frame_allowed(struct ieee80211_txrx_data *rx)
1261 * requires that rx->skb is a frame with ethernet header 1261 * requires that rx->skb is a frame with ethernet header
1262 */ 1262 */
1263static void 1263static void
1264ieee80211_deliver_skb(struct ieee80211_txrx_data *rx) 1264ieee80211_deliver_skb(struct ieee80211_rx_data *rx)
1265{ 1265{
1266 struct net_device *dev = rx->dev; 1266 struct net_device *dev = rx->dev;
1267 struct ieee80211_local *local = rx->local; 1267 struct ieee80211_local *local = rx->local;
@@ -1275,7 +1275,7 @@ ieee80211_deliver_skb(struct ieee80211_txrx_data *rx)
1275 1275
1276 if (local->bridge_packets && (sdata->vif.type == IEEE80211_IF_TYPE_AP || 1276 if (local->bridge_packets && (sdata->vif.type == IEEE80211_IF_TYPE_AP ||
1277 sdata->vif.type == IEEE80211_IF_TYPE_VLAN) && 1277 sdata->vif.type == IEEE80211_IF_TYPE_VLAN) &&
1278 (rx->flags & IEEE80211_TXRXD_RXRA_MATCH)) { 1278 (rx->flags & IEEE80211_RX_RA_MATCH)) {
1279 if (is_multicast_ether_addr(ehdr->h_dest)) { 1279 if (is_multicast_ether_addr(ehdr->h_dest)) {
1280 /* 1280 /*
1281 * send multicast frames both to higher layers in 1281 * send multicast frames both to higher layers in
@@ -1351,7 +1351,7 @@ ieee80211_deliver_skb(struct ieee80211_txrx_data *rx)
1351} 1351}
1352 1352
1353static ieee80211_rx_result 1353static ieee80211_rx_result
1354ieee80211_rx_h_amsdu(struct ieee80211_txrx_data *rx) 1354ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx)
1355{ 1355{
1356 struct net_device *dev = rx->dev; 1356 struct net_device *dev = rx->dev;
1357 struct ieee80211_local *local = rx->local; 1357 struct ieee80211_local *local = rx->local;
@@ -1371,7 +1371,7 @@ ieee80211_rx_h_amsdu(struct ieee80211_txrx_data *rx)
1371 if (unlikely(!WLAN_FC_DATA_PRESENT(fc))) 1371 if (unlikely(!WLAN_FC_DATA_PRESENT(fc)))
1372 return RX_DROP_MONITOR; 1372 return RX_DROP_MONITOR;
1373 1373
1374 if (!(rx->flags & IEEE80211_TXRXD_RX_AMSDU)) 1374 if (!(rx->flags & IEEE80211_RX_AMSDU))
1375 return RX_CONTINUE; 1375 return RX_CONTINUE;
1376 1376
1377 err = ieee80211_data_to_8023(rx); 1377 err = ieee80211_data_to_8023(rx);
@@ -1468,7 +1468,7 @@ ieee80211_rx_h_amsdu(struct ieee80211_txrx_data *rx)
1468} 1468}
1469 1469
1470static ieee80211_rx_result 1470static ieee80211_rx_result
1471ieee80211_rx_h_data(struct ieee80211_txrx_data *rx) 1471ieee80211_rx_h_data(struct ieee80211_rx_data *rx)
1472{ 1472{
1473 struct net_device *dev = rx->dev; 1473 struct net_device *dev = rx->dev;
1474 u16 fc; 1474 u16 fc;
@@ -1499,7 +1499,7 @@ ieee80211_rx_h_data(struct ieee80211_txrx_data *rx)
1499} 1499}
1500 1500
1501static ieee80211_rx_result 1501static ieee80211_rx_result
1502ieee80211_rx_h_ctrl(struct ieee80211_txrx_data *rx) 1502ieee80211_rx_h_ctrl(struct ieee80211_rx_data *rx)
1503{ 1503{
1504 struct ieee80211_local *local = rx->local; 1504 struct ieee80211_local *local = rx->local;
1505 struct ieee80211_hw *hw = &local->hw; 1505 struct ieee80211_hw *hw = &local->hw;
@@ -1542,11 +1542,11 @@ ieee80211_rx_h_ctrl(struct ieee80211_txrx_data *rx)
1542} 1542}
1543 1543
1544static ieee80211_rx_result 1544static ieee80211_rx_result
1545ieee80211_rx_h_mgmt(struct ieee80211_txrx_data *rx) 1545ieee80211_rx_h_mgmt(struct ieee80211_rx_data *rx)
1546{ 1546{
1547 struct ieee80211_sub_if_data *sdata; 1547 struct ieee80211_sub_if_data *sdata;
1548 1548
1549 if (!(rx->flags & IEEE80211_TXRXD_RXRA_MATCH)) 1549 if (!(rx->flags & IEEE80211_RX_RA_MATCH))
1550 return RX_DROP_MONITOR; 1550 return RX_DROP_MONITOR;
1551 1551
1552 sdata = IEEE80211_DEV_TO_SUB_IF(rx->dev); 1552 sdata = IEEE80211_DEV_TO_SUB_IF(rx->dev);
@@ -1554,7 +1554,7 @@ ieee80211_rx_h_mgmt(struct ieee80211_txrx_data *rx)
1554 sdata->vif.type == IEEE80211_IF_TYPE_IBSS || 1554 sdata->vif.type == IEEE80211_IF_TYPE_IBSS ||
1555 sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT) && 1555 sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT) &&
1556 !(sdata->flags & IEEE80211_SDATA_USERSPACE_MLME)) 1556 !(sdata->flags & IEEE80211_SDATA_USERSPACE_MLME))
1557 ieee80211_sta_rx_mgmt(rx->dev, rx->skb, rx->u.rx.status); 1557 ieee80211_sta_rx_mgmt(rx->dev, rx->skb, rx->status);
1558 else 1558 else
1559 return RX_DROP_MONITOR; 1559 return RX_DROP_MONITOR;
1560 1560
@@ -1563,7 +1563,7 @@ ieee80211_rx_h_mgmt(struct ieee80211_txrx_data *rx)
1563 1563
1564static void ieee80211_rx_michael_mic_report(struct net_device *dev, 1564static void ieee80211_rx_michael_mic_report(struct net_device *dev,
1565 struct ieee80211_hdr *hdr, 1565 struct ieee80211_hdr *hdr,
1566 struct ieee80211_txrx_data *rx) 1566 struct ieee80211_rx_data *rx)
1567{ 1567{
1568 int keyidx, hdrlen; 1568 int keyidx, hdrlen;
1569 DECLARE_MAC_BUF(mac); 1569 DECLARE_MAC_BUF(mac);
@@ -1633,7 +1633,8 @@ static void ieee80211_rx_michael_mic_report(struct net_device *dev,
1633 rx->skb = NULL; 1633 rx->skb = NULL;
1634} 1634}
1635 1635
1636static void ieee80211_rx_cooked_monitor(struct ieee80211_txrx_data *rx) 1636/* TODO: use IEEE80211_RX_FRAGMENTED */
1637static void ieee80211_rx_cooked_monitor(struct ieee80211_rx_data *rx)
1637{ 1638{
1638 struct ieee80211_sub_if_data *sdata; 1639 struct ieee80211_sub_if_data *sdata;
1639 struct ieee80211_local *local = rx->local; 1640 struct ieee80211_local *local = rx->local;
@@ -1646,9 +1647,9 @@ static void ieee80211_rx_cooked_monitor(struct ieee80211_txrx_data *rx)
1646 } __attribute__ ((packed)) *rthdr; 1647 } __attribute__ ((packed)) *rthdr;
1647 struct sk_buff *skb = rx->skb, *skb2; 1648 struct sk_buff *skb = rx->skb, *skb2;
1648 struct net_device *prev_dev = NULL; 1649 struct net_device *prev_dev = NULL;
1649 struct ieee80211_rx_status *status = rx->u.rx.status; 1650 struct ieee80211_rx_status *status = rx->status;
1650 1651
1651 if (rx->flags & IEEE80211_TXRXD_RX_CMNTR_REPORTED) 1652 if (rx->flags & IEEE80211_RX_CMNTR_REPORTED)
1652 goto out_free_skb; 1653 goto out_free_skb;
1653 1654
1654 if (skb_headroom(skb) < sizeof(*rthdr) && 1655 if (skb_headroom(skb) < sizeof(*rthdr) &&
@@ -1663,7 +1664,7 @@ static void ieee80211_rx_cooked_monitor(struct ieee80211_txrx_data *rx)
1663 (1 << IEEE80211_RADIOTAP_RATE) | 1664 (1 << IEEE80211_RADIOTAP_RATE) |
1664 (1 << IEEE80211_RADIOTAP_CHANNEL)); 1665 (1 << IEEE80211_RADIOTAP_CHANNEL));
1665 1666
1666 rthdr->rate = rx->u.rx.rate->bitrate / 5; 1667 rthdr->rate = rx->rate->bitrate / 5;
1667 rthdr->chan_freq = cpu_to_le16(status->freq); 1668 rthdr->chan_freq = cpu_to_le16(status->freq);
1668 1669
1669 if (status->band == IEEE80211_BAND_5GHZ) 1670 if (status->band == IEEE80211_BAND_5GHZ)
@@ -1706,14 +1707,14 @@ static void ieee80211_rx_cooked_monitor(struct ieee80211_txrx_data *rx)
1706 } else 1707 } else
1707 goto out_free_skb; 1708 goto out_free_skb;
1708 1709
1709 rx->flags |= IEEE80211_TXRXD_RX_CMNTR_REPORTED; 1710 rx->flags |= IEEE80211_RX_CMNTR_REPORTED;
1710 return; 1711 return;
1711 1712
1712 out_free_skb: 1713 out_free_skb:
1713 dev_kfree_skb(skb); 1714 dev_kfree_skb(skb);
1714} 1715}
1715 1716
1716typedef ieee80211_rx_result (*ieee80211_rx_handler)(struct ieee80211_txrx_data *); 1717typedef ieee80211_rx_result (*ieee80211_rx_handler)(struct ieee80211_rx_data *);
1717static ieee80211_rx_handler ieee80211_rx_handlers[] = 1718static ieee80211_rx_handler ieee80211_rx_handlers[] =
1718{ 1719{
1719 ieee80211_rx_h_if_stats, 1720 ieee80211_rx_h_if_stats,
@@ -1737,7 +1738,7 @@ static ieee80211_rx_handler ieee80211_rx_handlers[] =
1737}; 1738};
1738 1739
1739static void ieee80211_invoke_rx_handlers(struct ieee80211_sub_if_data *sdata, 1740static void ieee80211_invoke_rx_handlers(struct ieee80211_sub_if_data *sdata,
1740 struct ieee80211_txrx_data *rx, 1741 struct ieee80211_rx_data *rx,
1741 struct sk_buff *skb) 1742 struct sk_buff *skb)
1742{ 1743{
1743 ieee80211_rx_handler *handler; 1744 ieee80211_rx_handler *handler;
@@ -1780,7 +1781,7 @@ static void ieee80211_invoke_rx_handlers(struct ieee80211_sub_if_data *sdata,
1780/* main receive path */ 1781/* main receive path */
1781 1782
1782static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata, 1783static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata,
1783 u8 *bssid, struct ieee80211_txrx_data *rx, 1784 u8 *bssid, struct ieee80211_rx_data *rx,
1784 struct ieee80211_hdr *hdr) 1785 struct ieee80211_hdr *hdr)
1785{ 1786{
1786 int multicast = is_multicast_ether_addr(hdr->addr1); 1787 int multicast = is_multicast_ether_addr(hdr->addr1);
@@ -1790,15 +1791,15 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata,
1790 if (!bssid) 1791 if (!bssid)
1791 return 0; 1792 return 0;
1792 if (!ieee80211_bssid_match(bssid, sdata->u.sta.bssid)) { 1793 if (!ieee80211_bssid_match(bssid, sdata->u.sta.bssid)) {
1793 if (!(rx->flags & IEEE80211_TXRXD_RXIN_SCAN)) 1794 if (!(rx->flags & IEEE80211_RX_IN_SCAN))
1794 return 0; 1795 return 0;
1795 rx->flags &= ~IEEE80211_TXRXD_RXRA_MATCH; 1796 rx->flags &= ~IEEE80211_RX_RA_MATCH;
1796 } else if (!multicast && 1797 } else if (!multicast &&
1797 compare_ether_addr(sdata->dev->dev_addr, 1798 compare_ether_addr(sdata->dev->dev_addr,
1798 hdr->addr1) != 0) { 1799 hdr->addr1) != 0) {
1799 if (!(sdata->dev->flags & IFF_PROMISC)) 1800 if (!(sdata->dev->flags & IFF_PROMISC))
1800 return 0; 1801 return 0;
1801 rx->flags &= ~IEEE80211_TXRXD_RXRA_MATCH; 1802 rx->flags &= ~IEEE80211_RX_RA_MATCH;
1802 } 1803 }
1803 break; 1804 break;
1804 case IEEE80211_IF_TYPE_IBSS: 1805 case IEEE80211_IF_TYPE_IBSS:
@@ -1808,15 +1809,15 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata,
1808 (rx->fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_BEACON) 1809 (rx->fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_BEACON)
1809 return 1; 1810 return 1;
1810 else if (!ieee80211_bssid_match(bssid, sdata->u.sta.bssid)) { 1811 else if (!ieee80211_bssid_match(bssid, sdata->u.sta.bssid)) {
1811 if (!(rx->flags & IEEE80211_TXRXD_RXIN_SCAN)) 1812 if (!(rx->flags & IEEE80211_RX_IN_SCAN))
1812 return 0; 1813 return 0;
1813 rx->flags &= ~IEEE80211_TXRXD_RXRA_MATCH; 1814 rx->flags &= ~IEEE80211_RX_RA_MATCH;
1814 } else if (!multicast && 1815 } else if (!multicast &&
1815 compare_ether_addr(sdata->dev->dev_addr, 1816 compare_ether_addr(sdata->dev->dev_addr,
1816 hdr->addr1) != 0) { 1817 hdr->addr1) != 0) {
1817 if (!(sdata->dev->flags & IFF_PROMISC)) 1818 if (!(sdata->dev->flags & IFF_PROMISC))
1818 return 0; 1819 return 0;
1819 rx->flags &= ~IEEE80211_TXRXD_RXRA_MATCH; 1820 rx->flags &= ~IEEE80211_RX_RA_MATCH;
1820 } else if (!rx->sta) 1821 } else if (!rx->sta)
1821 rx->sta = ieee80211_ibss_add_sta(sdata->dev, rx->skb, 1822 rx->sta = ieee80211_ibss_add_sta(sdata->dev, rx->skb,
1822 bssid, hdr->addr2); 1823 bssid, hdr->addr2);
@@ -1828,7 +1829,7 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata,
1828 if (!(sdata->dev->flags & IFF_PROMISC)) 1829 if (!(sdata->dev->flags & IFF_PROMISC))
1829 return 0; 1830 return 0;
1830 1831
1831 rx->flags &= ~IEEE80211_TXRXD_RXRA_MATCH; 1832 rx->flags &= ~IEEE80211_RX_RA_MATCH;
1832 } 1833 }
1833 break; 1834 break;
1834 case IEEE80211_IF_TYPE_VLAN: 1835 case IEEE80211_IF_TYPE_VLAN:
@@ -1839,12 +1840,12 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata,
1839 return 0; 1840 return 0;
1840 } else if (!ieee80211_bssid_match(bssid, 1841 } else if (!ieee80211_bssid_match(bssid,
1841 sdata->dev->dev_addr)) { 1842 sdata->dev->dev_addr)) {
1842 if (!(rx->flags & IEEE80211_TXRXD_RXIN_SCAN)) 1843 if (!(rx->flags & IEEE80211_RX_IN_SCAN))
1843 return 0; 1844 return 0;
1844 rx->flags &= ~IEEE80211_TXRXD_RXRA_MATCH; 1845 rx->flags &= ~IEEE80211_RX_RA_MATCH;
1845 } 1846 }
1846 if (sdata->dev == sdata->local->mdev && 1847 if (sdata->dev == sdata->local->mdev &&
1847 !(rx->flags & IEEE80211_TXRXD_RXIN_SCAN)) 1848 !(rx->flags & IEEE80211_RX_IN_SCAN))
1848 /* do not receive anything via 1849 /* do not receive anything via
1849 * master device when not scanning */ 1850 * master device when not scanning */
1850 return 0; 1851 return 0;
@@ -1881,7 +1882,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
1881 struct ieee80211_local *local = hw_to_local(hw); 1882 struct ieee80211_local *local = hw_to_local(hw);
1882 struct ieee80211_sub_if_data *sdata; 1883 struct ieee80211_sub_if_data *sdata;
1883 struct ieee80211_hdr *hdr; 1884 struct ieee80211_hdr *hdr;
1884 struct ieee80211_txrx_data rx; 1885 struct ieee80211_rx_data rx;
1885 u16 type; 1886 u16 type;
1886 int prepares; 1887 int prepares;
1887 struct ieee80211_sub_if_data *prev = NULL; 1888 struct ieee80211_sub_if_data *prev = NULL;
@@ -1893,9 +1894,9 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
1893 rx.skb = skb; 1894 rx.skb = skb;
1894 rx.local = local; 1895 rx.local = local;
1895 1896
1896 rx.u.rx.status = status; 1897 rx.status = status;
1897 rx.u.rx.load = load; 1898 rx.load = load;
1898 rx.u.rx.rate = rate; 1899 rx.rate = rate;
1899 rx.fc = le16_to_cpu(hdr->frame_control); 1900 rx.fc = le16_to_cpu(hdr->frame_control);
1900 type = rx.fc & IEEE80211_FCTL_FTYPE; 1901 type = rx.fc & IEEE80211_FCTL_FTYPE;
1901 1902
@@ -1914,7 +1915,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
1914 } 1915 }
1915 1916
1916 if (unlikely(local->sta_sw_scanning || local->sta_hw_scanning)) 1917 if (unlikely(local->sta_sw_scanning || local->sta_hw_scanning))
1917 rx.flags |= IEEE80211_TXRXD_RXIN_SCAN; 1918 rx.flags |= IEEE80211_RX_IN_SCAN;
1918 1919
1919 ieee80211_parse_qos(&rx); 1920 ieee80211_parse_qos(&rx);
1920 ieee80211_verify_ip_alignment(&rx); 1921 ieee80211_verify_ip_alignment(&rx);
@@ -1929,7 +1930,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
1929 continue; 1930 continue;
1930 1931
1931 bssid = ieee80211_get_bssid(hdr, skb->len, sdata->vif.type); 1932 bssid = ieee80211_get_bssid(hdr, skb->len, sdata->vif.type);
1932 rx.flags |= IEEE80211_TXRXD_RXRA_MATCH; 1933 rx.flags |= IEEE80211_RX_RA_MATCH;
1933 prepares = prepare_for_handlers(sdata, bssid, &rx, hdr); 1934 prepares = prepare_for_handlers(sdata, bssid, &rx, hdr);
1934 1935
1935 if (!prepares) 1936 if (!prepares)