diff options
Diffstat (limited to 'net/mac80211/rx.c')
-rw-r--r-- | net/mac80211/rx.c | 526 |
1 files changed, 223 insertions, 303 deletions
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 0941e5d6a52..6a88e8f9bff 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -61,22 +61,147 @@ static inline int should_drop_frame(struct ieee80211_rx_status *status, | |||
61 | int present_fcs_len, | 61 | int present_fcs_len, |
62 | int radiotap_len) | 62 | int radiotap_len) |
63 | { | 63 | { |
64 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | 64 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
65 | 65 | ||
66 | if (status->flag & (RX_FLAG_FAILED_FCS_CRC | RX_FLAG_FAILED_PLCP_CRC)) | 66 | if (status->flag & (RX_FLAG_FAILED_FCS_CRC | RX_FLAG_FAILED_PLCP_CRC)) |
67 | return 1; | 67 | return 1; |
68 | if (unlikely(skb->len < 16 + present_fcs_len + radiotap_len)) | 68 | if (unlikely(skb->len < 16 + present_fcs_len + radiotap_len)) |
69 | return 1; | 69 | return 1; |
70 | if (((hdr->frame_control & cpu_to_le16(IEEE80211_FCTL_FTYPE)) == | 70 | if (ieee80211_is_ctl(hdr->frame_control) && |
71 | cpu_to_le16(IEEE80211_FTYPE_CTL)) && | 71 | !ieee80211_is_pspoll(hdr->frame_control) && |
72 | ((hdr->frame_control & cpu_to_le16(IEEE80211_FCTL_STYPE)) != | 72 | !ieee80211_is_back_req(hdr->frame_control)) |
73 | cpu_to_le16(IEEE80211_STYPE_PSPOLL)) && | ||
74 | ((hdr->frame_control & cpu_to_le16(IEEE80211_FCTL_STYPE)) != | ||
75 | cpu_to_le16(IEEE80211_STYPE_BACK_REQ))) | ||
76 | return 1; | 73 | return 1; |
77 | return 0; | 74 | return 0; |
78 | } | 75 | } |
79 | 76 | ||
77 | static int | ||
78 | ieee80211_rx_radiotap_len(struct ieee80211_local *local, | ||
79 | struct ieee80211_rx_status *status) | ||
80 | { | ||
81 | int len; | ||
82 | |||
83 | /* always present fields */ | ||
84 | len = sizeof(struct ieee80211_radiotap_header) + 9; | ||
85 | |||
86 | if (status->flag & RX_FLAG_TSFT) | ||
87 | len += 8; | ||
88 | if (local->hw.flags & IEEE80211_HW_SIGNAL_DB || | ||
89 | local->hw.flags & IEEE80211_HW_SIGNAL_DBM) | ||
90 | len += 1; | ||
91 | if (local->hw.flags & IEEE80211_HW_NOISE_DBM) | ||
92 | len += 1; | ||
93 | |||
94 | if (len & 1) /* padding for RX_FLAGS if necessary */ | ||
95 | len++; | ||
96 | |||
97 | /* make sure radiotap starts at a naturally aligned address */ | ||
98 | if (len % 8) | ||
99 | len = roundup(len, 8); | ||
100 | |||
101 | return len; | ||
102 | } | ||
103 | |||
104 | /** | ||
105 | * ieee80211_add_rx_radiotap_header - add radiotap header | ||
106 | * | ||
107 | * add a radiotap header containing all the fields which the hardware provided. | ||
108 | */ | ||
109 | static void | ||
110 | ieee80211_add_rx_radiotap_header(struct ieee80211_local *local, | ||
111 | struct sk_buff *skb, | ||
112 | struct ieee80211_rx_status *status, | ||
113 | struct ieee80211_rate *rate, | ||
114 | int rtap_len) | ||
115 | { | ||
116 | struct ieee80211_radiotap_header *rthdr; | ||
117 | unsigned char *pos; | ||
118 | |||
119 | rthdr = (struct ieee80211_radiotap_header *)skb_push(skb, rtap_len); | ||
120 | memset(rthdr, 0, rtap_len); | ||
121 | |||
122 | /* radiotap header, set always present flags */ | ||
123 | rthdr->it_present = | ||
124 | cpu_to_le32((1 << IEEE80211_RADIOTAP_FLAGS) | | ||
125 | (1 << IEEE80211_RADIOTAP_RATE) | | ||
126 | (1 << IEEE80211_RADIOTAP_CHANNEL) | | ||
127 | (1 << IEEE80211_RADIOTAP_ANTENNA) | | ||
128 | (1 << IEEE80211_RADIOTAP_RX_FLAGS)); | ||
129 | rthdr->it_len = cpu_to_le16(rtap_len); | ||
130 | |||
131 | pos = (unsigned char *)(rthdr+1); | ||
132 | |||
133 | /* the order of the following fields is important */ | ||
134 | |||
135 | /* IEEE80211_RADIOTAP_TSFT */ | ||
136 | if (status->flag & RX_FLAG_TSFT) { | ||
137 | *(__le64 *)pos = cpu_to_le64(status->mactime); | ||
138 | rthdr->it_present |= | ||
139 | cpu_to_le32(1 << IEEE80211_RADIOTAP_TSFT); | ||
140 | pos += 8; | ||
141 | } | ||
142 | |||
143 | /* IEEE80211_RADIOTAP_FLAGS */ | ||
144 | if (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS) | ||
145 | *pos |= IEEE80211_RADIOTAP_F_FCS; | ||
146 | pos++; | ||
147 | |||
148 | /* IEEE80211_RADIOTAP_RATE */ | ||
149 | *pos = rate->bitrate / 5; | ||
150 | pos++; | ||
151 | |||
152 | /* IEEE80211_RADIOTAP_CHANNEL */ | ||
153 | *(__le16 *)pos = cpu_to_le16(status->freq); | ||
154 | pos += 2; | ||
155 | if (status->band == IEEE80211_BAND_5GHZ) | ||
156 | *(__le16 *)pos = cpu_to_le16(IEEE80211_CHAN_OFDM | | ||
157 | IEEE80211_CHAN_5GHZ); | ||
158 | else | ||
159 | *(__le16 *)pos = cpu_to_le16(IEEE80211_CHAN_DYN | | ||
160 | IEEE80211_CHAN_2GHZ); | ||
161 | pos += 2; | ||
162 | |||
163 | /* IEEE80211_RADIOTAP_DBM_ANTSIGNAL */ | ||
164 | if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM) { | ||
165 | *pos = status->signal; | ||
166 | rthdr->it_present |= | ||
167 | cpu_to_le32(1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL); | ||
168 | pos++; | ||
169 | } | ||
170 | |||
171 | /* IEEE80211_RADIOTAP_DBM_ANTNOISE */ | ||
172 | if (local->hw.flags & IEEE80211_HW_NOISE_DBM) { | ||
173 | *pos = status->noise; | ||
174 | rthdr->it_present |= | ||
175 | cpu_to_le32(1 << IEEE80211_RADIOTAP_DBM_ANTNOISE); | ||
176 | pos++; | ||
177 | } | ||
178 | |||
179 | /* IEEE80211_RADIOTAP_LOCK_QUALITY is missing */ | ||
180 | |||
181 | /* IEEE80211_RADIOTAP_ANTENNA */ | ||
182 | *pos = status->antenna; | ||
183 | pos++; | ||
184 | |||
185 | /* IEEE80211_RADIOTAP_DB_ANTSIGNAL */ | ||
186 | if (local->hw.flags & IEEE80211_HW_SIGNAL_DB) { | ||
187 | *pos = status->signal; | ||
188 | rthdr->it_present |= | ||
189 | cpu_to_le32(1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL); | ||
190 | pos++; | ||
191 | } | ||
192 | |||
193 | /* IEEE80211_RADIOTAP_DB_ANTNOISE is not used */ | ||
194 | |||
195 | /* IEEE80211_RADIOTAP_RX_FLAGS */ | ||
196 | /* ensure 2 byte alignment for the 2 byte field as required */ | ||
197 | if ((pos - (unsigned char *)rthdr) & 1) | ||
198 | pos++; | ||
199 | /* FIXME: when radiotap gets a 'bad PLCP' flag use it here */ | ||
200 | if (status->flag & (RX_FLAG_FAILED_FCS_CRC | RX_FLAG_FAILED_PLCP_CRC)) | ||
201 | *(__le16 *)pos |= cpu_to_le16(IEEE80211_RADIOTAP_F_RX_BADFCS); | ||
202 | pos += 2; | ||
203 | } | ||
204 | |||
80 | /* | 205 | /* |
81 | * This function copies a received frame to all monitor interfaces and | 206 | * This function copies a received frame to all monitor interfaces and |
82 | * returns a cleaned-up SKB that no longer includes the FCS nor the | 207 | * returns a cleaned-up SKB that no longer includes the FCS nor the |
@@ -89,17 +214,6 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb, | |||
89 | { | 214 | { |
90 | struct ieee80211_sub_if_data *sdata; | 215 | struct ieee80211_sub_if_data *sdata; |
91 | int needed_headroom = 0; | 216 | int needed_headroom = 0; |
92 | struct ieee80211_radiotap_header *rthdr; | ||
93 | __le64 *rttsft = NULL; | ||
94 | struct ieee80211_rtap_fixed_data { | ||
95 | u8 flags; | ||
96 | u8 rate; | ||
97 | __le16 chan_freq; | ||
98 | __le16 chan_flags; | ||
99 | u8 antsignal; | ||
100 | u8 padding_for_rxflags; | ||
101 | __le16 rx_flags; | ||
102 | } __attribute__ ((packed)) *rtfixed; | ||
103 | struct sk_buff *skb, *skb2; | 217 | struct sk_buff *skb, *skb2; |
104 | struct net_device *prev_dev = NULL; | 218 | struct net_device *prev_dev = NULL; |
105 | int present_fcs_len = 0; | 219 | int present_fcs_len = 0; |
@@ -116,8 +230,8 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb, | |||
116 | if (status->flag & RX_FLAG_RADIOTAP) | 230 | if (status->flag & RX_FLAG_RADIOTAP) |
117 | rtap_len = ieee80211_get_radiotap_len(origskb->data); | 231 | rtap_len = ieee80211_get_radiotap_len(origskb->data); |
118 | else | 232 | else |
119 | /* room for radiotap header, always present fields and TSFT */ | 233 | /* room for the radiotap header based on driver features */ |
120 | needed_headroom = sizeof(*rthdr) + sizeof(*rtfixed) + 8; | 234 | needed_headroom = ieee80211_rx_radiotap_len(local, status); |
121 | 235 | ||
122 | if (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS) | 236 | if (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS) |
123 | present_fcs_len = FCS_LEN; | 237 | present_fcs_len = FCS_LEN; |
@@ -163,55 +277,9 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb, | |||
163 | } | 277 | } |
164 | 278 | ||
165 | /* if necessary, prepend radiotap information */ | 279 | /* if necessary, prepend radiotap information */ |
166 | if (!(status->flag & RX_FLAG_RADIOTAP)) { | 280 | if (!(status->flag & RX_FLAG_RADIOTAP)) |
167 | rtfixed = (void *) skb_push(skb, sizeof(*rtfixed)); | 281 | ieee80211_add_rx_radiotap_header(local, skb, status, rate, |
168 | rtap_len = sizeof(*rthdr) + sizeof(*rtfixed); | 282 | needed_headroom); |
169 | if (status->flag & RX_FLAG_TSFT) { | ||
170 | rttsft = (void *) skb_push(skb, sizeof(*rttsft)); | ||
171 | rtap_len += 8; | ||
172 | } | ||
173 | rthdr = (void *) skb_push(skb, sizeof(*rthdr)); | ||
174 | memset(rthdr, 0, sizeof(*rthdr)); | ||
175 | memset(rtfixed, 0, sizeof(*rtfixed)); | ||
176 | rthdr->it_present = | ||
177 | cpu_to_le32((1 << IEEE80211_RADIOTAP_FLAGS) | | ||
178 | (1 << IEEE80211_RADIOTAP_RATE) | | ||
179 | (1 << IEEE80211_RADIOTAP_CHANNEL) | | ||
180 | (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL) | | ||
181 | (1 << IEEE80211_RADIOTAP_RX_FLAGS)); | ||
182 | rtfixed->flags = 0; | ||
183 | if (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS) | ||
184 | rtfixed->flags |= IEEE80211_RADIOTAP_F_FCS; | ||
185 | |||
186 | if (rttsft) { | ||
187 | *rttsft = cpu_to_le64(status->mactime); | ||
188 | rthdr->it_present |= | ||
189 | cpu_to_le32(1 << IEEE80211_RADIOTAP_TSFT); | ||
190 | } | ||
191 | |||
192 | /* FIXME: when radiotap gets a 'bad PLCP' flag use it here */ | ||
193 | rtfixed->rx_flags = 0; | ||
194 | if (status->flag & | ||
195 | (RX_FLAG_FAILED_FCS_CRC | RX_FLAG_FAILED_PLCP_CRC)) | ||
196 | rtfixed->rx_flags |= | ||
197 | cpu_to_le16(IEEE80211_RADIOTAP_F_RX_BADFCS); | ||
198 | |||
199 | rtfixed->rate = rate->bitrate / 5; | ||
200 | |||
201 | rtfixed->chan_freq = cpu_to_le16(status->freq); | ||
202 | |||
203 | if (status->band == IEEE80211_BAND_5GHZ) | ||
204 | rtfixed->chan_flags = | ||
205 | cpu_to_le16(IEEE80211_CHAN_OFDM | | ||
206 | IEEE80211_CHAN_5GHZ); | ||
207 | else | ||
208 | rtfixed->chan_flags = | ||
209 | cpu_to_le16(IEEE80211_CHAN_DYN | | ||
210 | IEEE80211_CHAN_2GHZ); | ||
211 | |||
212 | rtfixed->antsignal = status->ssi; | ||
213 | rthdr->it_len = cpu_to_le16(rtap_len); | ||
214 | } | ||
215 | 283 | ||
216 | skb_reset_mac_header(skb); | 284 | skb_reset_mac_header(skb); |
217 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 285 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
@@ -275,11 +343,6 @@ static void ieee80211_parse_qos(struct ieee80211_rx_data *rx) | |||
275 | } | 343 | } |
276 | } | 344 | } |
277 | 345 | ||
278 | I802_DEBUG_INC(rx->local->wme_rx_queue[tid]); | ||
279 | /* only a debug counter, sta might not be assigned properly yet */ | ||
280 | if (rx->sta) | ||
281 | I802_DEBUG_INC(rx->sta->wme_rx_queue[tid]); | ||
282 | |||
283 | rx->queue = tid; | 346 | rx->queue = tid; |
284 | /* Set skb->priority to 1d tag if highest order bit of TID is not set. | 347 | /* 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. */ | 348 | * For now, set skb->priority to 0 for other cases. */ |
@@ -321,51 +384,9 @@ static void ieee80211_verify_ip_alignment(struct ieee80211_rx_data *rx) | |||
321 | } | 384 | } |
322 | 385 | ||
323 | 386 | ||
324 | static u32 ieee80211_rx_load_stats(struct ieee80211_local *local, | ||
325 | struct sk_buff *skb, | ||
326 | struct ieee80211_rx_status *status, | ||
327 | struct ieee80211_rate *rate) | ||
328 | { | ||
329 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | ||
330 | u32 load = 0, hdrtime; | ||
331 | |||
332 | /* Estimate total channel use caused by this frame */ | ||
333 | |||
334 | /* 1 bit at 1 Mbit/s takes 1 usec; in channel_use values, | ||
335 | * 1 usec = 1/8 * (1080 / 10) = 13.5 */ | ||
336 | |||
337 | if (status->band == IEEE80211_BAND_5GHZ || | ||
338 | (status->band == IEEE80211_BAND_5GHZ && | ||
339 | rate->flags & IEEE80211_RATE_ERP_G)) | ||
340 | hdrtime = CHAN_UTIL_HDR_SHORT; | ||
341 | else | ||
342 | hdrtime = CHAN_UTIL_HDR_LONG; | ||
343 | |||
344 | load = hdrtime; | ||
345 | if (!is_multicast_ether_addr(hdr->addr1)) | ||
346 | load += hdrtime; | ||
347 | |||
348 | /* TODO: optimise again */ | ||
349 | load += skb->len * CHAN_UTIL_RATE_LCM / rate->bitrate; | ||
350 | |||
351 | /* Divide channel_use by 8 to avoid wrapping around the counter */ | ||
352 | load >>= CHAN_UTIL_SHIFT; | ||
353 | |||
354 | return load; | ||
355 | } | ||
356 | |||
357 | /* rx handlers */ | 387 | /* rx handlers */ |
358 | 388 | ||
359 | static ieee80211_rx_result | 389 | static ieee80211_rx_result debug_noinline |
360 | ieee80211_rx_h_if_stats(struct ieee80211_rx_data *rx) | ||
361 | { | ||
362 | if (rx->sta) | ||
363 | rx->sta->channel_use_raw += rx->load; | ||
364 | rx->sdata->channel_use_raw += rx->load; | ||
365 | return RX_CONTINUE; | ||
366 | } | ||
367 | |||
368 | static ieee80211_rx_result | ||
369 | ieee80211_rx_h_passive_scan(struct ieee80211_rx_data *rx) | 390 | ieee80211_rx_h_passive_scan(struct ieee80211_rx_data *rx) |
370 | { | 391 | { |
371 | struct ieee80211_local *local = rx->local; | 392 | struct ieee80211_local *local = rx->local; |
@@ -442,7 +463,7 @@ ieee80211_rx_mesh_check(struct ieee80211_rx_data *rx) | |||
442 | } | 463 | } |
443 | 464 | ||
444 | 465 | ||
445 | static ieee80211_rx_result | 466 | static ieee80211_rx_result debug_noinline |
446 | ieee80211_rx_h_check(struct ieee80211_rx_data *rx) | 467 | ieee80211_rx_h_check(struct ieee80211_rx_data *rx) |
447 | { | 468 | { |
448 | struct ieee80211_hdr *hdr; | 469 | struct ieee80211_hdr *hdr; |
@@ -484,7 +505,7 @@ ieee80211_rx_h_check(struct ieee80211_rx_data *rx) | |||
484 | ((rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL && | 505 | ((rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL && |
485 | (rx->fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PSPOLL)) && | 506 | (rx->fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PSPOLL)) && |
486 | rx->sdata->vif.type != IEEE80211_IF_TYPE_IBSS && | 507 | rx->sdata->vif.type != IEEE80211_IF_TYPE_IBSS && |
487 | (!rx->sta || !(rx->sta->flags & WLAN_STA_ASSOC)))) { | 508 | (!rx->sta || !test_sta_flags(rx->sta, WLAN_STA_ASSOC)))) { |
488 | if ((!(rx->fc & IEEE80211_FCTL_FROMDS) && | 509 | if ((!(rx->fc & IEEE80211_FCTL_FROMDS) && |
489 | !(rx->fc & IEEE80211_FCTL_TODS) && | 510 | !(rx->fc & IEEE80211_FCTL_TODS) && |
490 | (rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) | 511 | (rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) |
@@ -501,7 +522,7 @@ ieee80211_rx_h_check(struct ieee80211_rx_data *rx) | |||
501 | } | 522 | } |
502 | 523 | ||
503 | 524 | ||
504 | static ieee80211_rx_result | 525 | static ieee80211_rx_result debug_noinline |
505 | ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx) | 526 | ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx) |
506 | { | 527 | { |
507 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) rx->skb->data; | 528 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) rx->skb->data; |
@@ -592,11 +613,6 @@ ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx) | |||
592 | rx->key->tx_rx_count++; | 613 | rx->key->tx_rx_count++; |
593 | /* TODO: add threshold stuff again */ | 614 | /* TODO: add threshold stuff again */ |
594 | } else { | 615 | } else { |
595 | #ifdef CONFIG_MAC80211_DEBUG | ||
596 | if (net_ratelimit()) | ||
597 | printk(KERN_DEBUG "%s: RX protected frame," | ||
598 | " but have no key\n", rx->dev->name); | ||
599 | #endif /* CONFIG_MAC80211_DEBUG */ | ||
600 | return RX_DROP_MONITOR; | 616 | return RX_DROP_MONITOR; |
601 | } | 617 | } |
602 | 618 | ||
@@ -635,8 +651,7 @@ static void ap_sta_ps_start(struct net_device *dev, struct sta_info *sta) | |||
635 | 651 | ||
636 | if (sdata->bss) | 652 | if (sdata->bss) |
637 | atomic_inc(&sdata->bss->num_sta_ps); | 653 | atomic_inc(&sdata->bss->num_sta_ps); |
638 | sta->flags |= WLAN_STA_PS; | 654 | set_and_clear_sta_flags(sta, WLAN_STA_PS, WLAN_STA_PSPOLL); |
639 | sta->flags &= ~WLAN_STA_PSPOLL; | ||
640 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 655 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG |
641 | printk(KERN_DEBUG "%s: STA %s aid %d enters power save mode\n", | 656 | printk(KERN_DEBUG "%s: STA %s aid %d enters power save mode\n", |
642 | dev->name, print_mac(mac, sta->addr), sta->aid); | 657 | dev->name, print_mac(mac, sta->addr), sta->aid); |
@@ -649,7 +664,7 @@ static int ap_sta_ps_end(struct net_device *dev, struct sta_info *sta) | |||
649 | struct sk_buff *skb; | 664 | struct sk_buff *skb; |
650 | int sent = 0; | 665 | int sent = 0; |
651 | struct ieee80211_sub_if_data *sdata; | 666 | struct ieee80211_sub_if_data *sdata; |
652 | struct ieee80211_tx_packet_data *pkt_data; | 667 | struct ieee80211_tx_info *info; |
653 | DECLARE_MAC_BUF(mac); | 668 | DECLARE_MAC_BUF(mac); |
654 | 669 | ||
655 | sdata = sta->sdata; | 670 | sdata = sta->sdata; |
@@ -657,7 +672,7 @@ static int ap_sta_ps_end(struct net_device *dev, struct sta_info *sta) | |||
657 | if (sdata->bss) | 672 | if (sdata->bss) |
658 | atomic_dec(&sdata->bss->num_sta_ps); | 673 | atomic_dec(&sdata->bss->num_sta_ps); |
659 | 674 | ||
660 | sta->flags &= ~(WLAN_STA_PS | WLAN_STA_PSPOLL); | 675 | clear_sta_flags(sta, WLAN_STA_PS | WLAN_STA_PSPOLL); |
661 | 676 | ||
662 | if (!skb_queue_empty(&sta->ps_tx_buf)) | 677 | if (!skb_queue_empty(&sta->ps_tx_buf)) |
663 | sta_info_clear_tim_bit(sta); | 678 | sta_info_clear_tim_bit(sta); |
@@ -669,13 +684,13 @@ static int ap_sta_ps_end(struct net_device *dev, struct sta_info *sta) | |||
669 | 684 | ||
670 | /* Send all buffered frames to the station */ | 685 | /* Send all buffered frames to the station */ |
671 | while ((skb = skb_dequeue(&sta->tx_filtered)) != NULL) { | 686 | while ((skb = skb_dequeue(&sta->tx_filtered)) != NULL) { |
672 | pkt_data = (struct ieee80211_tx_packet_data *) skb->cb; | 687 | info = IEEE80211_SKB_CB(skb); |
673 | sent++; | 688 | sent++; |
674 | pkt_data->flags |= IEEE80211_TXPD_REQUEUE; | 689 | info->flags |= IEEE80211_TX_CTL_REQUEUE; |
675 | dev_queue_xmit(skb); | 690 | dev_queue_xmit(skb); |
676 | } | 691 | } |
677 | while ((skb = skb_dequeue(&sta->ps_tx_buf)) != NULL) { | 692 | while ((skb = skb_dequeue(&sta->ps_tx_buf)) != NULL) { |
678 | pkt_data = (struct ieee80211_tx_packet_data *) skb->cb; | 693 | info = IEEE80211_SKB_CB(skb); |
679 | local->total_ps_buffered--; | 694 | local->total_ps_buffered--; |
680 | sent++; | 695 | sent++; |
681 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 696 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG |
@@ -683,14 +698,14 @@ static int ap_sta_ps_end(struct net_device *dev, struct sta_info *sta) | |||
683 | "since STA not sleeping anymore\n", dev->name, | 698 | "since STA not sleeping anymore\n", dev->name, |
684 | print_mac(mac, sta->addr), sta->aid); | 699 | print_mac(mac, sta->addr), sta->aid); |
685 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ | 700 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ |
686 | pkt_data->flags |= IEEE80211_TXPD_REQUEUE; | 701 | info->flags |= IEEE80211_TX_CTL_REQUEUE; |
687 | dev_queue_xmit(skb); | 702 | dev_queue_xmit(skb); |
688 | } | 703 | } |
689 | 704 | ||
690 | return sent; | 705 | return sent; |
691 | } | 706 | } |
692 | 707 | ||
693 | static ieee80211_rx_result | 708 | static ieee80211_rx_result debug_noinline |
694 | ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx) | 709 | ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx) |
695 | { | 710 | { |
696 | struct sta_info *sta = rx->sta; | 711 | struct sta_info *sta = rx->sta; |
@@ -725,16 +740,17 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx) | |||
725 | 740 | ||
726 | sta->rx_fragments++; | 741 | sta->rx_fragments++; |
727 | sta->rx_bytes += rx->skb->len; | 742 | sta->rx_bytes += rx->skb->len; |
728 | sta->last_rssi = rx->status->ssi; | ||
729 | sta->last_signal = rx->status->signal; | 743 | sta->last_signal = rx->status->signal; |
744 | sta->last_qual = rx->status->qual; | ||
730 | sta->last_noise = rx->status->noise; | 745 | sta->last_noise = rx->status->noise; |
731 | 746 | ||
732 | if (!(rx->fc & IEEE80211_FCTL_MOREFRAGS)) { | 747 | if (!(rx->fc & IEEE80211_FCTL_MOREFRAGS)) { |
733 | /* Change STA power saving mode only in the end of a frame | 748 | /* Change STA power saving mode only in the end of a frame |
734 | * exchange sequence */ | 749 | * exchange sequence */ |
735 | if ((sta->flags & WLAN_STA_PS) && !(rx->fc & IEEE80211_FCTL_PM)) | 750 | if (test_sta_flags(sta, WLAN_STA_PS) && |
751 | !(rx->fc & IEEE80211_FCTL_PM)) | ||
736 | rx->sent_ps_buffered += ap_sta_ps_end(dev, sta); | 752 | rx->sent_ps_buffered += ap_sta_ps_end(dev, sta); |
737 | else if (!(sta->flags & WLAN_STA_PS) && | 753 | else if (!test_sta_flags(sta, WLAN_STA_PS) && |
738 | (rx->fc & IEEE80211_FCTL_PM)) | 754 | (rx->fc & IEEE80211_FCTL_PM)) |
739 | ap_sta_ps_start(dev, sta); | 755 | ap_sta_ps_start(dev, sta); |
740 | } | 756 | } |
@@ -768,7 +784,7 @@ ieee80211_reassemble_add(struct ieee80211_sub_if_data *sdata, | |||
768 | sdata->fragment_next = 0; | 784 | sdata->fragment_next = 0; |
769 | 785 | ||
770 | if (!skb_queue_empty(&entry->skb_list)) { | 786 | if (!skb_queue_empty(&entry->skb_list)) { |
771 | #ifdef CONFIG_MAC80211_DEBUG | 787 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
772 | struct ieee80211_hdr *hdr = | 788 | struct ieee80211_hdr *hdr = |
773 | (struct ieee80211_hdr *) entry->skb_list.next->data; | 789 | (struct ieee80211_hdr *) entry->skb_list.next->data; |
774 | DECLARE_MAC_BUF(mac); | 790 | DECLARE_MAC_BUF(mac); |
@@ -780,7 +796,7 @@ ieee80211_reassemble_add(struct ieee80211_sub_if_data *sdata, | |||
780 | jiffies - entry->first_frag_time, entry->seq, | 796 | jiffies - entry->first_frag_time, entry->seq, |
781 | entry->last_frag, print_mac(mac, hdr->addr1), | 797 | entry->last_frag, print_mac(mac, hdr->addr1), |
782 | print_mac(mac2, hdr->addr2)); | 798 | print_mac(mac2, hdr->addr2)); |
783 | #endif /* CONFIG_MAC80211_DEBUG */ | 799 | #endif |
784 | __skb_queue_purge(&entry->skb_list); | 800 | __skb_queue_purge(&entry->skb_list); |
785 | } | 801 | } |
786 | 802 | ||
@@ -837,7 +853,7 @@ ieee80211_reassemble_find(struct ieee80211_sub_if_data *sdata, | |||
837 | return NULL; | 853 | return NULL; |
838 | } | 854 | } |
839 | 855 | ||
840 | static ieee80211_rx_result | 856 | static ieee80211_rx_result debug_noinline |
841 | ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx) | 857 | ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx) |
842 | { | 858 | { |
843 | struct ieee80211_hdr *hdr; | 859 | struct ieee80211_hdr *hdr; |
@@ -901,18 +917,8 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx) | |||
901 | break; | 917 | break; |
902 | } | 918 | } |
903 | rpn = rx->key->u.ccmp.rx_pn[rx->queue]; | 919 | rpn = rx->key->u.ccmp.rx_pn[rx->queue]; |
904 | if (memcmp(pn, rpn, CCMP_PN_LEN) != 0) { | 920 | if (memcmp(pn, rpn, CCMP_PN_LEN)) |
905 | if (net_ratelimit()) | ||
906 | printk(KERN_DEBUG "%s: defrag: CCMP PN not " | ||
907 | "sequential A2=%s" | ||
908 | " PN=%02x%02x%02x%02x%02x%02x " | ||
909 | "(expected %02x%02x%02x%02x%02x%02x)\n", | ||
910 | rx->dev->name, print_mac(mac, hdr->addr2), | ||
911 | rpn[0], rpn[1], rpn[2], rpn[3], rpn[4], | ||
912 | rpn[5], pn[0], pn[1], pn[2], pn[3], | ||
913 | pn[4], pn[5]); | ||
914 | return RX_DROP_UNUSABLE; | 921 | return RX_DROP_UNUSABLE; |
915 | } | ||
916 | memcpy(entry->last_pn, pn, CCMP_PN_LEN); | 922 | memcpy(entry->last_pn, pn, CCMP_PN_LEN); |
917 | } | 923 | } |
918 | 924 | ||
@@ -953,7 +959,7 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx) | |||
953 | return RX_CONTINUE; | 959 | return RX_CONTINUE; |
954 | } | 960 | } |
955 | 961 | ||
956 | static ieee80211_rx_result | 962 | static ieee80211_rx_result debug_noinline |
957 | ieee80211_rx_h_ps_poll(struct ieee80211_rx_data *rx) | 963 | ieee80211_rx_h_ps_poll(struct ieee80211_rx_data *rx) |
958 | { | 964 | { |
959 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(rx->dev); | 965 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(rx->dev); |
@@ -988,7 +994,7 @@ ieee80211_rx_h_ps_poll(struct ieee80211_rx_data *rx) | |||
988 | * Tell TX path to send one frame even though the STA may | 994 | * Tell TX path to send one frame even though the STA may |
989 | * still remain is PS mode after this frame exchange. | 995 | * still remain is PS mode after this frame exchange. |
990 | */ | 996 | */ |
991 | rx->sta->flags |= WLAN_STA_PSPOLL; | 997 | set_sta_flags(rx->sta, WLAN_STA_PSPOLL); |
992 | 998 | ||
993 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 999 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG |
994 | printk(KERN_DEBUG "STA %s aid %d: PS Poll (entries after %d)\n", | 1000 | printk(KERN_DEBUG "STA %s aid %d: PS Poll (entries after %d)\n", |
@@ -1016,7 +1022,7 @@ ieee80211_rx_h_ps_poll(struct ieee80211_rx_data *rx) | |||
1016 | * have nothing buffered for it? | 1022 | * have nothing buffered for it? |
1017 | */ | 1023 | */ |
1018 | printk(KERN_DEBUG "%s: STA %s sent PS Poll even " | 1024 | printk(KERN_DEBUG "%s: STA %s sent PS Poll even " |
1019 | "though there is no buffered frames for it\n", | 1025 | "though there are no buffered frames for it\n", |
1020 | rx->dev->name, print_mac(mac, rx->sta->addr)); | 1026 | rx->dev->name, print_mac(mac, rx->sta->addr)); |
1021 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ | 1027 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ |
1022 | } | 1028 | } |
@@ -1028,7 +1034,7 @@ ieee80211_rx_h_ps_poll(struct ieee80211_rx_data *rx) | |||
1028 | return RX_QUEUED; | 1034 | return RX_QUEUED; |
1029 | } | 1035 | } |
1030 | 1036 | ||
1031 | static ieee80211_rx_result | 1037 | static ieee80211_rx_result debug_noinline |
1032 | ieee80211_rx_h_remove_qos_control(struct ieee80211_rx_data *rx) | 1038 | ieee80211_rx_h_remove_qos_control(struct ieee80211_rx_data *rx) |
1033 | { | 1039 | { |
1034 | u16 fc = rx->fc; | 1040 | u16 fc = rx->fc; |
@@ -1051,14 +1057,9 @@ ieee80211_rx_h_remove_qos_control(struct ieee80211_rx_data *rx) | |||
1051 | static int | 1057 | static int |
1052 | ieee80211_802_1x_port_control(struct ieee80211_rx_data *rx) | 1058 | ieee80211_802_1x_port_control(struct ieee80211_rx_data *rx) |
1053 | { | 1059 | { |
1054 | if (unlikely(!rx->sta || !(rx->sta->flags & WLAN_STA_AUTHORIZED))) { | 1060 | if (unlikely(!rx->sta || |
1055 | #ifdef CONFIG_MAC80211_DEBUG | 1061 | !test_sta_flags(rx->sta, WLAN_STA_AUTHORIZED))) |
1056 | if (net_ratelimit()) | ||
1057 | printk(KERN_DEBUG "%s: dropped frame " | ||
1058 | "(unauthorized port)\n", rx->dev->name); | ||
1059 | #endif /* CONFIG_MAC80211_DEBUG */ | ||
1060 | return -EACCES; | 1062 | return -EACCES; |
1061 | } | ||
1062 | 1063 | ||
1063 | return 0; | 1064 | return 0; |
1064 | } | 1065 | } |
@@ -1138,16 +1139,8 @@ ieee80211_data_to_8023(struct ieee80211_rx_data *rx) | |||
1138 | memcpy(src, hdr->addr2, ETH_ALEN); | 1139 | memcpy(src, hdr->addr2, ETH_ALEN); |
1139 | 1140 | ||
1140 | if (unlikely(sdata->vif.type != IEEE80211_IF_TYPE_AP && | 1141 | if (unlikely(sdata->vif.type != IEEE80211_IF_TYPE_AP && |
1141 | sdata->vif.type != IEEE80211_IF_TYPE_VLAN)) { | 1142 | sdata->vif.type != IEEE80211_IF_TYPE_VLAN)) |
1142 | if (net_ratelimit()) | ||
1143 | printk(KERN_DEBUG "%s: dropped ToDS frame " | ||
1144 | "(BSSID=%s SA=%s DA=%s)\n", | ||
1145 | dev->name, | ||
1146 | print_mac(mac, hdr->addr1), | ||
1147 | print_mac(mac2, hdr->addr2), | ||
1148 | print_mac(mac3, hdr->addr3)); | ||
1149 | return -1; | 1143 | return -1; |
1150 | } | ||
1151 | break; | 1144 | break; |
1152 | case (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS): | 1145 | case (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS): |
1153 | /* RA TA DA SA */ | 1146 | /* RA TA DA SA */ |
@@ -1155,17 +1148,8 @@ ieee80211_data_to_8023(struct ieee80211_rx_data *rx) | |||
1155 | memcpy(src, hdr->addr4, ETH_ALEN); | 1148 | memcpy(src, hdr->addr4, ETH_ALEN); |
1156 | 1149 | ||
1157 | if (unlikely(sdata->vif.type != IEEE80211_IF_TYPE_WDS && | 1150 | if (unlikely(sdata->vif.type != IEEE80211_IF_TYPE_WDS && |
1158 | sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT)) { | 1151 | sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT)) |
1159 | if (net_ratelimit()) | ||
1160 | printk(KERN_DEBUG "%s: dropped FromDS&ToDS " | ||
1161 | "frame (RA=%s TA=%s DA=%s SA=%s)\n", | ||
1162 | rx->dev->name, | ||
1163 | print_mac(mac, hdr->addr1), | ||
1164 | print_mac(mac2, hdr->addr2), | ||
1165 | print_mac(mac3, hdr->addr3), | ||
1166 | print_mac(mac4, hdr->addr4)); | ||
1167 | return -1; | 1152 | return -1; |
1168 | } | ||
1169 | break; | 1153 | break; |
1170 | case IEEE80211_FCTL_FROMDS: | 1154 | case IEEE80211_FCTL_FROMDS: |
1171 | /* DA BSSID SA */ | 1155 | /* DA BSSID SA */ |
@@ -1182,27 +1166,13 @@ ieee80211_data_to_8023(struct ieee80211_rx_data *rx) | |||
1182 | memcpy(dst, hdr->addr1, ETH_ALEN); | 1166 | memcpy(dst, hdr->addr1, ETH_ALEN); |
1183 | memcpy(src, hdr->addr2, ETH_ALEN); | 1167 | memcpy(src, hdr->addr2, ETH_ALEN); |
1184 | 1168 | ||
1185 | if (sdata->vif.type != IEEE80211_IF_TYPE_IBSS) { | 1169 | if (sdata->vif.type != IEEE80211_IF_TYPE_IBSS) |
1186 | if (net_ratelimit()) { | ||
1187 | printk(KERN_DEBUG "%s: dropped IBSS frame " | ||
1188 | "(DA=%s SA=%s BSSID=%s)\n", | ||
1189 | dev->name, | ||
1190 | print_mac(mac, hdr->addr1), | ||
1191 | print_mac(mac2, hdr->addr2), | ||
1192 | print_mac(mac3, hdr->addr3)); | ||
1193 | } | ||
1194 | return -1; | 1170 | return -1; |
1195 | } | ||
1196 | break; | 1171 | break; |
1197 | } | 1172 | } |
1198 | 1173 | ||
1199 | if (unlikely(skb->len - hdrlen < 8)) { | 1174 | if (unlikely(skb->len - hdrlen < 8)) |
1200 | if (net_ratelimit()) { | ||
1201 | printk(KERN_DEBUG "%s: RX too short data frame " | ||
1202 | "payload\n", dev->name); | ||
1203 | } | ||
1204 | return -1; | 1175 | return -1; |
1205 | } | ||
1206 | 1176 | ||
1207 | payload = skb->data + hdrlen; | 1177 | payload = skb->data + hdrlen; |
1208 | ethertype = (payload[6] << 8) | payload[7]; | 1178 | ethertype = (payload[6] << 8) | payload[7]; |
@@ -1345,7 +1315,7 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx) | |||
1345 | } | 1315 | } |
1346 | } | 1316 | } |
1347 | 1317 | ||
1348 | static ieee80211_rx_result | 1318 | static ieee80211_rx_result debug_noinline |
1349 | ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx) | 1319 | ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx) |
1350 | { | 1320 | { |
1351 | struct net_device *dev = rx->dev; | 1321 | struct net_device *dev = rx->dev; |
@@ -1394,10 +1364,8 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx) | |||
1394 | 1364 | ||
1395 | padding = ((4 - subframe_len) & 0x3); | 1365 | padding = ((4 - subframe_len) & 0x3); |
1396 | /* the last MSDU has no padding */ | 1366 | /* the last MSDU has no padding */ |
1397 | if (subframe_len > remaining) { | 1367 | if (subframe_len > remaining) |
1398 | printk(KERN_DEBUG "%s: wrong buffer size\n", dev->name); | ||
1399 | return RX_DROP_UNUSABLE; | 1368 | return RX_DROP_UNUSABLE; |
1400 | } | ||
1401 | 1369 | ||
1402 | skb_pull(skb, sizeof(struct ethhdr)); | 1370 | skb_pull(skb, sizeof(struct ethhdr)); |
1403 | /* if last subframe reuse skb */ | 1371 | /* if last subframe reuse skb */ |
@@ -1418,8 +1386,6 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx) | |||
1418 | eth = (struct ethhdr *) skb_pull(skb, ntohs(len) + | 1386 | eth = (struct ethhdr *) skb_pull(skb, ntohs(len) + |
1419 | padding); | 1387 | padding); |
1420 | if (!eth) { | 1388 | if (!eth) { |
1421 | printk(KERN_DEBUG "%s: wrong buffer size\n", | ||
1422 | dev->name); | ||
1423 | dev_kfree_skb(frame); | 1389 | dev_kfree_skb(frame); |
1424 | return RX_DROP_UNUSABLE; | 1390 | return RX_DROP_UNUSABLE; |
1425 | } | 1391 | } |
@@ -1462,7 +1428,7 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx) | |||
1462 | return RX_QUEUED; | 1428 | return RX_QUEUED; |
1463 | } | 1429 | } |
1464 | 1430 | ||
1465 | static ieee80211_rx_result | 1431 | static ieee80211_rx_result debug_noinline |
1466 | ieee80211_rx_h_data(struct ieee80211_rx_data *rx) | 1432 | ieee80211_rx_h_data(struct ieee80211_rx_data *rx) |
1467 | { | 1433 | { |
1468 | struct net_device *dev = rx->dev; | 1434 | struct net_device *dev = rx->dev; |
@@ -1493,7 +1459,7 @@ ieee80211_rx_h_data(struct ieee80211_rx_data *rx) | |||
1493 | return RX_QUEUED; | 1459 | return RX_QUEUED; |
1494 | } | 1460 | } |
1495 | 1461 | ||
1496 | static ieee80211_rx_result | 1462 | static ieee80211_rx_result debug_noinline |
1497 | ieee80211_rx_h_ctrl(struct ieee80211_rx_data *rx) | 1463 | ieee80211_rx_h_ctrl(struct ieee80211_rx_data *rx) |
1498 | { | 1464 | { |
1499 | struct ieee80211_local *local = rx->local; | 1465 | struct ieee80211_local *local = rx->local; |
@@ -1537,7 +1503,7 @@ ieee80211_rx_h_ctrl(struct ieee80211_rx_data *rx) | |||
1537 | return RX_CONTINUE; | 1503 | return RX_CONTINUE; |
1538 | } | 1504 | } |
1539 | 1505 | ||
1540 | static ieee80211_rx_result | 1506 | static ieee80211_rx_result debug_noinline |
1541 | ieee80211_rx_h_mgmt(struct ieee80211_rx_data *rx) | 1507 | ieee80211_rx_h_mgmt(struct ieee80211_rx_data *rx) |
1542 | { | 1508 | { |
1543 | struct ieee80211_sub_if_data *sdata; | 1509 | struct ieee80211_sub_if_data *sdata; |
@@ -1571,31 +1537,16 @@ static void ieee80211_rx_michael_mic_report(struct net_device *dev, | |||
1571 | else | 1537 | else |
1572 | keyidx = -1; | 1538 | keyidx = -1; |
1573 | 1539 | ||
1574 | if (net_ratelimit()) | ||
1575 | printk(KERN_DEBUG "%s: TKIP hwaccel reported Michael MIC " | ||
1576 | "failure from %s to %s keyidx=%d\n", | ||
1577 | dev->name, print_mac(mac, hdr->addr2), | ||
1578 | print_mac(mac2, hdr->addr1), keyidx); | ||
1579 | |||
1580 | if (!rx->sta) { | 1540 | if (!rx->sta) { |
1581 | /* | 1541 | /* |
1582 | * Some hardware seem to generate incorrect Michael MIC | 1542 | * Some hardware seem to generate incorrect Michael MIC |
1583 | * reports; ignore them to avoid triggering countermeasures. | 1543 | * reports; ignore them to avoid triggering countermeasures. |
1584 | */ | 1544 | */ |
1585 | if (net_ratelimit()) | ||
1586 | printk(KERN_DEBUG "%s: ignored spurious Michael MIC " | ||
1587 | "error for unknown address %s\n", | ||
1588 | dev->name, print_mac(mac, hdr->addr2)); | ||
1589 | goto ignore; | 1545 | goto ignore; |
1590 | } | 1546 | } |
1591 | 1547 | ||
1592 | if (!(rx->fc & IEEE80211_FCTL_PROTECTED)) { | 1548 | if (!(rx->fc & IEEE80211_FCTL_PROTECTED)) |
1593 | if (net_ratelimit()) | ||
1594 | printk(KERN_DEBUG "%s: ignored spurious Michael MIC " | ||
1595 | "error for a frame with no PROTECTED flag (src " | ||
1596 | "%s)\n", dev->name, print_mac(mac, hdr->addr2)); | ||
1597 | goto ignore; | 1549 | goto ignore; |
1598 | } | ||
1599 | 1550 | ||
1600 | if (rx->sdata->vif.type == IEEE80211_IF_TYPE_AP && keyidx) { | 1551 | if (rx->sdata->vif.type == IEEE80211_IF_TYPE_AP && keyidx) { |
1601 | /* | 1552 | /* |
@@ -1604,24 +1555,13 @@ static void ieee80211_rx_michael_mic_report(struct net_device *dev, | |||
1604 | * group keys and only the AP is sending real multicast | 1555 | * group keys and only the AP is sending real multicast |
1605 | * frames in the BSS. | 1556 | * frames in the BSS. |
1606 | */ | 1557 | */ |
1607 | if (net_ratelimit()) | ||
1608 | printk(KERN_DEBUG "%s: ignored Michael MIC error for " | ||
1609 | "a frame with non-zero keyidx (%d)" | ||
1610 | " (src %s)\n", dev->name, keyidx, | ||
1611 | print_mac(mac, hdr->addr2)); | ||
1612 | goto ignore; | 1558 | goto ignore; |
1613 | } | 1559 | } |
1614 | 1560 | ||
1615 | if ((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA && | 1561 | if ((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA && |
1616 | ((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_MGMT || | 1562 | ((rx->fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_MGMT || |
1617 | (rx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_AUTH)) { | 1563 | (rx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_AUTH)) |
1618 | if (net_ratelimit()) | ||
1619 | printk(KERN_DEBUG "%s: ignored spurious Michael MIC " | ||
1620 | "error for a frame that cannot be encrypted " | ||
1621 | "(fc=0x%04x) (src %s)\n", | ||
1622 | dev->name, rx->fc, print_mac(mac, hdr->addr2)); | ||
1623 | goto ignore; | 1564 | goto ignore; |
1624 | } | ||
1625 | 1565 | ||
1626 | mac80211_ev_michael_mic_failure(rx->dev, keyidx, hdr); | 1566 | mac80211_ev_michael_mic_failure(rx->dev, keyidx, hdr); |
1627 | ignore: | 1567 | ignore: |
@@ -1710,67 +1650,57 @@ static void ieee80211_rx_cooked_monitor(struct ieee80211_rx_data *rx) | |||
1710 | dev_kfree_skb(skb); | 1650 | dev_kfree_skb(skb); |
1711 | } | 1651 | } |
1712 | 1652 | ||
1713 | typedef ieee80211_rx_result (*ieee80211_rx_handler)(struct ieee80211_rx_data *); | ||
1714 | static ieee80211_rx_handler ieee80211_rx_handlers[] = | ||
1715 | { | ||
1716 | ieee80211_rx_h_if_stats, | ||
1717 | ieee80211_rx_h_passive_scan, | ||
1718 | ieee80211_rx_h_check, | ||
1719 | ieee80211_rx_h_decrypt, | ||
1720 | ieee80211_rx_h_sta_process, | ||
1721 | ieee80211_rx_h_defragment, | ||
1722 | ieee80211_rx_h_ps_poll, | ||
1723 | ieee80211_rx_h_michael_mic_verify, | ||
1724 | /* this must be after decryption - so header is counted in MPDU mic | ||
1725 | * must be before pae and data, so QOS_DATA format frames | ||
1726 | * are not passed to user space by these functions | ||
1727 | */ | ||
1728 | ieee80211_rx_h_remove_qos_control, | ||
1729 | ieee80211_rx_h_amsdu, | ||
1730 | ieee80211_rx_h_data, | ||
1731 | ieee80211_rx_h_ctrl, | ||
1732 | ieee80211_rx_h_mgmt, | ||
1733 | NULL | ||
1734 | }; | ||
1735 | 1653 | ||
1736 | static void ieee80211_invoke_rx_handlers(struct ieee80211_sub_if_data *sdata, | 1654 | static void ieee80211_invoke_rx_handlers(struct ieee80211_sub_if_data *sdata, |
1737 | struct ieee80211_rx_data *rx, | 1655 | struct ieee80211_rx_data *rx, |
1738 | struct sk_buff *skb) | 1656 | struct sk_buff *skb) |
1739 | { | 1657 | { |
1740 | ieee80211_rx_handler *handler; | ||
1741 | ieee80211_rx_result res = RX_DROP_MONITOR; | 1658 | ieee80211_rx_result res = RX_DROP_MONITOR; |
1742 | 1659 | ||
1743 | rx->skb = skb; | 1660 | rx->skb = skb; |
1744 | rx->sdata = sdata; | 1661 | rx->sdata = sdata; |
1745 | rx->dev = sdata->dev; | 1662 | rx->dev = sdata->dev; |
1746 | 1663 | ||
1747 | for (handler = ieee80211_rx_handlers; *handler != NULL; handler++) { | 1664 | #define CALL_RXH(rxh) \ |
1748 | res = (*handler)(rx); | 1665 | res = rxh(rx); \ |
1749 | 1666 | if (res != RX_CONTINUE) \ | |
1750 | switch (res) { | 1667 | goto rxh_done; |
1751 | case RX_CONTINUE: | 1668 | |
1752 | continue; | 1669 | CALL_RXH(ieee80211_rx_h_passive_scan) |
1753 | case RX_DROP_UNUSABLE: | 1670 | CALL_RXH(ieee80211_rx_h_check) |
1754 | case RX_DROP_MONITOR: | 1671 | CALL_RXH(ieee80211_rx_h_decrypt) |
1755 | I802_DEBUG_INC(sdata->local->rx_handlers_drop); | 1672 | CALL_RXH(ieee80211_rx_h_sta_process) |
1756 | if (rx->sta) | 1673 | CALL_RXH(ieee80211_rx_h_defragment) |
1757 | rx->sta->rx_dropped++; | 1674 | CALL_RXH(ieee80211_rx_h_ps_poll) |
1758 | break; | 1675 | CALL_RXH(ieee80211_rx_h_michael_mic_verify) |
1759 | case RX_QUEUED: | 1676 | /* must be after MMIC verify so header is counted in MPDU mic */ |
1760 | I802_DEBUG_INC(sdata->local->rx_handlers_queued); | 1677 | CALL_RXH(ieee80211_rx_h_remove_qos_control) |
1761 | break; | 1678 | CALL_RXH(ieee80211_rx_h_amsdu) |
1762 | } | 1679 | CALL_RXH(ieee80211_rx_h_data) |
1763 | break; | 1680 | CALL_RXH(ieee80211_rx_h_ctrl) |
1764 | } | 1681 | CALL_RXH(ieee80211_rx_h_mgmt) |
1765 | 1682 | ||
1683 | #undef CALL_RXH | ||
1684 | |||
1685 | rxh_done: | ||
1766 | switch (res) { | 1686 | switch (res) { |
1767 | case RX_CONTINUE: | ||
1768 | case RX_DROP_MONITOR: | 1687 | case RX_DROP_MONITOR: |
1688 | I802_DEBUG_INC(sdata->local->rx_handlers_drop); | ||
1689 | if (rx->sta) | ||
1690 | rx->sta->rx_dropped++; | ||
1691 | /* fall through */ | ||
1692 | case RX_CONTINUE: | ||
1769 | ieee80211_rx_cooked_monitor(rx); | 1693 | ieee80211_rx_cooked_monitor(rx); |
1770 | break; | 1694 | break; |
1771 | case RX_DROP_UNUSABLE: | 1695 | case RX_DROP_UNUSABLE: |
1696 | I802_DEBUG_INC(sdata->local->rx_handlers_drop); | ||
1697 | if (rx->sta) | ||
1698 | rx->sta->rx_dropped++; | ||
1772 | dev_kfree_skb(rx->skb); | 1699 | dev_kfree_skb(rx->skb); |
1773 | break; | 1700 | break; |
1701 | case RX_QUEUED: | ||
1702 | I802_DEBUG_INC(sdata->local->rx_handlers_queued); | ||
1703 | break; | ||
1774 | } | 1704 | } |
1775 | } | 1705 | } |
1776 | 1706 | ||
@@ -1802,8 +1732,13 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata, | |||
1802 | if (!bssid) | 1732 | if (!bssid) |
1803 | return 0; | 1733 | return 0; |
1804 | if ((rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT && | 1734 | if ((rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT && |
1805 | (rx->fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_BEACON) | 1735 | (rx->fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_BEACON) { |
1736 | if (!rx->sta) | ||
1737 | rx->sta = ieee80211_ibss_add_sta(sdata->dev, | ||
1738 | rx->skb, bssid, hdr->addr2, | ||
1739 | BIT(rx->status->rate_idx)); | ||
1806 | return 1; | 1740 | return 1; |
1741 | } | ||
1807 | else if (!ieee80211_bssid_match(bssid, sdata->u.sta.bssid)) { | 1742 | else if (!ieee80211_bssid_match(bssid, sdata->u.sta.bssid)) { |
1808 | if (!(rx->flags & IEEE80211_RX_IN_SCAN)) | 1743 | if (!(rx->flags & IEEE80211_RX_IN_SCAN)) |
1809 | return 0; | 1744 | return 0; |
@@ -1816,7 +1751,8 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata, | |||
1816 | rx->flags &= ~IEEE80211_RX_RA_MATCH; | 1751 | rx->flags &= ~IEEE80211_RX_RA_MATCH; |
1817 | } else if (!rx->sta) | 1752 | } else if (!rx->sta) |
1818 | rx->sta = ieee80211_ibss_add_sta(sdata->dev, rx->skb, | 1753 | rx->sta = ieee80211_ibss_add_sta(sdata->dev, rx->skb, |
1819 | bssid, hdr->addr2); | 1754 | bssid, hdr->addr2, |
1755 | BIT(rx->status->rate_idx)); | ||
1820 | break; | 1756 | break; |
1821 | case IEEE80211_IF_TYPE_MESH_POINT: | 1757 | case IEEE80211_IF_TYPE_MESH_POINT: |
1822 | if (!multicast && | 1758 | if (!multicast && |
@@ -1872,7 +1808,6 @@ static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata, | |||
1872 | static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, | 1808 | static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, |
1873 | struct sk_buff *skb, | 1809 | struct sk_buff *skb, |
1874 | struct ieee80211_rx_status *status, | 1810 | struct ieee80211_rx_status *status, |
1875 | u32 load, | ||
1876 | struct ieee80211_rate *rate) | 1811 | struct ieee80211_rate *rate) |
1877 | { | 1812 | { |
1878 | struct ieee80211_local *local = hw_to_local(hw); | 1813 | struct ieee80211_local *local = hw_to_local(hw); |
@@ -1891,7 +1826,6 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, | |||
1891 | rx.local = local; | 1826 | rx.local = local; |
1892 | 1827 | ||
1893 | rx.status = status; | 1828 | rx.status = status; |
1894 | rx.load = load; | ||
1895 | rx.rate = rate; | 1829 | rx.rate = rate; |
1896 | rx.fc = le16_to_cpu(hdr->frame_control); | 1830 | rx.fc = le16_to_cpu(hdr->frame_control); |
1897 | type = rx.fc & IEEE80211_FCTL_FTYPE; | 1831 | type = rx.fc & IEEE80211_FCTL_FTYPE; |
@@ -2000,7 +1934,6 @@ u8 ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw, | |||
2000 | struct ieee80211_rx_status status; | 1934 | struct ieee80211_rx_status status; |
2001 | u16 head_seq_num, buf_size; | 1935 | u16 head_seq_num, buf_size; |
2002 | int index; | 1936 | int index; |
2003 | u32 pkt_load; | ||
2004 | struct ieee80211_supported_band *sband; | 1937 | struct ieee80211_supported_band *sband; |
2005 | struct ieee80211_rate *rate; | 1938 | struct ieee80211_rate *rate; |
2006 | 1939 | ||
@@ -2035,12 +1968,9 @@ u8 ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw, | |||
2035 | sizeof(status)); | 1968 | sizeof(status)); |
2036 | sband = local->hw.wiphy->bands[status.band]; | 1969 | sband = local->hw.wiphy->bands[status.band]; |
2037 | rate = &sband->bitrates[status.rate_idx]; | 1970 | rate = &sband->bitrates[status.rate_idx]; |
2038 | pkt_load = ieee80211_rx_load_stats(local, | ||
2039 | tid_agg_rx->reorder_buf[index], | ||
2040 | &status, rate); | ||
2041 | __ieee80211_rx_handle_packet(hw, | 1971 | __ieee80211_rx_handle_packet(hw, |
2042 | tid_agg_rx->reorder_buf[index], | 1972 | tid_agg_rx->reorder_buf[index], |
2043 | &status, pkt_load, rate); | 1973 | &status, rate); |
2044 | tid_agg_rx->stored_mpdu_num--; | 1974 | tid_agg_rx->stored_mpdu_num--; |
2045 | tid_agg_rx->reorder_buf[index] = NULL; | 1975 | tid_agg_rx->reorder_buf[index] = NULL; |
2046 | } | 1976 | } |
@@ -2082,11 +2012,8 @@ u8 ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw, | |||
2082 | sizeof(status)); | 2012 | sizeof(status)); |
2083 | sband = local->hw.wiphy->bands[status.band]; | 2013 | sband = local->hw.wiphy->bands[status.band]; |
2084 | rate = &sband->bitrates[status.rate_idx]; | 2014 | rate = &sband->bitrates[status.rate_idx]; |
2085 | pkt_load = ieee80211_rx_load_stats(local, | ||
2086 | tid_agg_rx->reorder_buf[index], | ||
2087 | &status, rate); | ||
2088 | __ieee80211_rx_handle_packet(hw, tid_agg_rx->reorder_buf[index], | 2015 | __ieee80211_rx_handle_packet(hw, tid_agg_rx->reorder_buf[index], |
2089 | &status, pkt_load, rate); | 2016 | &status, rate); |
2090 | tid_agg_rx->stored_mpdu_num--; | 2017 | tid_agg_rx->stored_mpdu_num--; |
2091 | tid_agg_rx->reorder_buf[index] = NULL; | 2018 | tid_agg_rx->reorder_buf[index] = NULL; |
2092 | tid_agg_rx->head_seq_num = seq_inc(tid_agg_rx->head_seq_num); | 2019 | tid_agg_rx->head_seq_num = seq_inc(tid_agg_rx->head_seq_num); |
@@ -2103,24 +2030,21 @@ static u8 ieee80211_rx_reorder_ampdu(struct ieee80211_local *local, | |||
2103 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | 2030 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; |
2104 | struct sta_info *sta; | 2031 | struct sta_info *sta; |
2105 | struct tid_ampdu_rx *tid_agg_rx; | 2032 | struct tid_ampdu_rx *tid_agg_rx; |
2106 | u16 fc, sc; | 2033 | u16 sc; |
2107 | u16 mpdu_seq_num; | 2034 | u16 mpdu_seq_num; |
2108 | u8 ret = 0, *qc; | 2035 | u8 ret = 0; |
2109 | int tid; | 2036 | int tid; |
2110 | 2037 | ||
2111 | sta = sta_info_get(local, hdr->addr2); | 2038 | sta = sta_info_get(local, hdr->addr2); |
2112 | if (!sta) | 2039 | if (!sta) |
2113 | return ret; | 2040 | return ret; |
2114 | 2041 | ||
2115 | fc = le16_to_cpu(hdr->frame_control); | ||
2116 | |||
2117 | /* filter the QoS data rx stream according to | 2042 | /* filter the QoS data rx stream according to |
2118 | * STA/TID and check if this STA/TID is on aggregation */ | 2043 | * STA/TID and check if this STA/TID is on aggregation */ |
2119 | if (!WLAN_FC_IS_QOS_DATA(fc)) | 2044 | if (!ieee80211_is_data_qos(hdr->frame_control)) |
2120 | goto end_reorder; | 2045 | goto end_reorder; |
2121 | 2046 | ||
2122 | qc = skb->data + ieee80211_get_hdrlen(fc) - QOS_CONTROL_LEN; | 2047 | tid = *ieee80211_get_qos_ctl(hdr) & QOS_CONTROL_TID_MASK; |
2123 | tid = qc[0] & QOS_CONTROL_TID_MASK; | ||
2124 | 2048 | ||
2125 | if (sta->ampdu_mlme.tid_state_rx[tid] != HT_AGG_STATE_OPERATIONAL) | 2049 | if (sta->ampdu_mlme.tid_state_rx[tid] != HT_AGG_STATE_OPERATIONAL) |
2126 | goto end_reorder; | 2050 | goto end_reorder; |
@@ -2128,7 +2052,7 @@ static u8 ieee80211_rx_reorder_ampdu(struct ieee80211_local *local, | |||
2128 | tid_agg_rx = sta->ampdu_mlme.tid_rx[tid]; | 2052 | tid_agg_rx = sta->ampdu_mlme.tid_rx[tid]; |
2129 | 2053 | ||
2130 | /* null data frames are excluded */ | 2054 | /* null data frames are excluded */ |
2131 | if (unlikely(fc & IEEE80211_STYPE_NULLFUNC)) | 2055 | if (unlikely(ieee80211_is_nullfunc(hdr->frame_control))) |
2132 | goto end_reorder; | 2056 | goto end_reorder; |
2133 | 2057 | ||
2134 | /* new un-ordered ampdu frame - process it */ | 2058 | /* new un-ordered ampdu frame - process it */ |
@@ -2165,7 +2089,6 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
2165 | struct ieee80211_rx_status *status) | 2089 | struct ieee80211_rx_status *status) |
2166 | { | 2090 | { |
2167 | struct ieee80211_local *local = hw_to_local(hw); | 2091 | struct ieee80211_local *local = hw_to_local(hw); |
2168 | u32 pkt_load; | ||
2169 | struct ieee80211_rate *rate = NULL; | 2092 | struct ieee80211_rate *rate = NULL; |
2170 | struct ieee80211_supported_band *sband; | 2093 | struct ieee80211_supported_band *sband; |
2171 | 2094 | ||
@@ -2205,11 +2128,8 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
2205 | return; | 2128 | return; |
2206 | } | 2129 | } |
2207 | 2130 | ||
2208 | pkt_load = ieee80211_rx_load_stats(local, skb, status, rate); | ||
2209 | local->channel_use_raw += pkt_load; | ||
2210 | |||
2211 | if (!ieee80211_rx_reorder_ampdu(local, skb)) | 2131 | if (!ieee80211_rx_reorder_ampdu(local, skb)) |
2212 | __ieee80211_rx_handle_packet(hw, skb, status, pkt_load, rate); | 2132 | __ieee80211_rx_handle_packet(hw, skb, status, rate); |
2213 | 2133 | ||
2214 | rcu_read_unlock(); | 2134 | rcu_read_unlock(); |
2215 | } | 2135 | } |