aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/b43/main.c2
-rw-r--r--drivers/net/wireless/b43legacy/main.c2
-rw-r--r--include/net/mac80211.h15
-rw-r--r--net/mac80211/iface.c8
-rw-r--r--net/mac80211/rx.c33
5 files changed, 25 insertions, 35 deletions
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index ed6e96a34743..c806924c7b5c 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -3573,7 +3573,7 @@ static int b43_op_config(struct ieee80211_hw *hw, u32 changed)
3573 if (conf->channel->hw_value != phy->channel) 3573 if (conf->channel->hw_value != phy->channel)
3574 b43_switch_channel(dev, conf->channel->hw_value); 3574 b43_switch_channel(dev, conf->channel->hw_value);
3575 3575
3576 dev->wl->radiotap_enabled = !!(conf->flags & IEEE80211_CONF_RADIOTAP); 3576 dev->wl->radiotap_enabled = !!(conf->flags & IEEE80211_CONF_MONITOR);
3577 3577
3578 /* Adjust the desired TX power level. */ 3578 /* Adjust the desired TX power level. */
3579 if (conf->power_level != 0) { 3579 if (conf->power_level != 0) {
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c
index 0983406f4630..d579bb9035c4 100644
--- a/drivers/net/wireless/b43legacy/main.c
+++ b/drivers/net/wireless/b43legacy/main.c
@@ -2676,7 +2676,7 @@ static int b43legacy_op_dev_config(struct ieee80211_hw *hw,
2676 if (conf->channel->hw_value != phy->channel) 2676 if (conf->channel->hw_value != phy->channel)
2677 b43legacy_radio_selectchannel(dev, conf->channel->hw_value, 0); 2677 b43legacy_radio_selectchannel(dev, conf->channel->hw_value, 0);
2678 2678
2679 dev->wl->radiotap_enabled = !!(conf->flags & IEEE80211_CONF_RADIOTAP); 2679 dev->wl->radiotap_enabled = !!(conf->flags & IEEE80211_CONF_MONITOR);
2680 2680
2681 /* Adjust the desired TX power level. */ 2681 /* Adjust the desired TX power level. */
2682 if (conf->power_level != 0) { 2682 if (conf->power_level != 0) {
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index c42c4a820b89..2c9d3c719d8a 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -494,7 +494,6 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
494 * @RX_FLAG_MMIC_ERROR: Michael MIC error was reported on this frame. 494 * @RX_FLAG_MMIC_ERROR: Michael MIC error was reported on this frame.
495 * Use together with %RX_FLAG_MMIC_STRIPPED. 495 * Use together with %RX_FLAG_MMIC_STRIPPED.
496 * @RX_FLAG_DECRYPTED: This frame was decrypted in hardware. 496 * @RX_FLAG_DECRYPTED: This frame was decrypted in hardware.
497 * @RX_FLAG_RADIOTAP: This frame starts with a radiotap header.
498 * @RX_FLAG_MMIC_STRIPPED: the Michael MIC is stripped off this frame, 497 * @RX_FLAG_MMIC_STRIPPED: the Michael MIC is stripped off this frame,
499 * verification has been done by the hardware. 498 * verification has been done by the hardware.
500 * @RX_FLAG_IV_STRIPPED: The IV/ICV are stripped from this frame. 499 * @RX_FLAG_IV_STRIPPED: The IV/ICV are stripped from this frame.
@@ -515,7 +514,6 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
515enum mac80211_rx_flags { 514enum mac80211_rx_flags {
516 RX_FLAG_MMIC_ERROR = 1<<0, 515 RX_FLAG_MMIC_ERROR = 1<<0,
517 RX_FLAG_DECRYPTED = 1<<1, 516 RX_FLAG_DECRYPTED = 1<<1,
518 RX_FLAG_RADIOTAP = 1<<2,
519 RX_FLAG_MMIC_STRIPPED = 1<<3, 517 RX_FLAG_MMIC_STRIPPED = 1<<3,
520 RX_FLAG_IV_STRIPPED = 1<<4, 518 RX_FLAG_IV_STRIPPED = 1<<4,
521 RX_FLAG_FAILED_FCS_CRC = 1<<5, 519 RX_FLAG_FAILED_FCS_CRC = 1<<5,
@@ -565,7 +563,9 @@ struct ieee80211_rx_status {
565 * 563 *
566 * Flags to define PHY configuration options 564 * Flags to define PHY configuration options
567 * 565 *
568 * @IEEE80211_CONF_RADIOTAP: add radiotap header at receive time (if supported) 566 * @IEEE80211_CONF_MONITOR: there's a monitor interface present -- use this
567 * to determine for example whether to calculate timestamps for packets
568 * or not, do not use instead of filter flags!
569 * @IEEE80211_CONF_PS: Enable 802.11 power save mode (managed mode only) 569 * @IEEE80211_CONF_PS: Enable 802.11 power save mode (managed mode only)
570 * @IEEE80211_CONF_IDLE: The device is running, but idle; if the flag is set 570 * @IEEE80211_CONF_IDLE: The device is running, but idle; if the flag is set
571 * the driver should be prepared to handle configuration requests but 571 * the driver should be prepared to handle configuration requests but
@@ -574,7 +574,7 @@ struct ieee80211_rx_status {
574 * it can also be unset in that case when monitor interfaces are active. 574 * it can also be unset in that case when monitor interfaces are active.
575 */ 575 */
576enum ieee80211_conf_flags { 576enum ieee80211_conf_flags {
577 IEEE80211_CONF_RADIOTAP = (1<<0), 577 IEEE80211_CONF_MONITOR = (1<<0),
578 IEEE80211_CONF_PS = (1<<1), 578 IEEE80211_CONF_PS = (1<<1),
579 IEEE80211_CONF_IDLE = (1<<2), 579 IEEE80211_CONF_IDLE = (1<<2),
580}; 580};
@@ -584,7 +584,7 @@ enum ieee80211_conf_flags {
584 * enum ieee80211_conf_changed - denotes which configuration changed 584 * enum ieee80211_conf_changed - denotes which configuration changed
585 * 585 *
586 * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed 586 * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed
587 * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed 587 * @IEEE80211_CONF_CHANGE_MONITOR: the monitor flag changed
588 * @IEEE80211_CONF_CHANGE_PS: the PS flag or dynamic PS timeout changed 588 * @IEEE80211_CONF_CHANGE_PS: the PS flag or dynamic PS timeout changed
589 * @IEEE80211_CONF_CHANGE_POWER: the TX power changed 589 * @IEEE80211_CONF_CHANGE_POWER: the TX power changed
590 * @IEEE80211_CONF_CHANGE_CHANNEL: the channel/channel_type changed 590 * @IEEE80211_CONF_CHANGE_CHANNEL: the channel/channel_type changed
@@ -593,7 +593,7 @@ enum ieee80211_conf_flags {
593 */ 593 */
594enum ieee80211_conf_changed { 594enum ieee80211_conf_changed {
595 IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2), 595 IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2),
596 IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3), 596 IEEE80211_CONF_CHANGE_MONITOR = BIT(3),
597 IEEE80211_CONF_CHANGE_PS = BIT(4), 597 IEEE80211_CONF_CHANGE_PS = BIT(4),
598 IEEE80211_CONF_CHANGE_POWER = BIT(5), 598 IEEE80211_CONF_CHANGE_POWER = BIT(5),
599 IEEE80211_CONF_CHANGE_CHANNEL = BIT(6), 599 IEEE80211_CONF_CHANGE_CHANNEL = BIT(6),
@@ -1661,8 +1661,7 @@ void ieee80211_restart_hw(struct ieee80211_hw *hw);
1661 * ieee80211_rx - receive frame 1661 * ieee80211_rx - receive frame
1662 * 1662 *
1663 * Use this function to hand received frames to mac80211. The receive 1663 * Use this function to hand received frames to mac80211. The receive
1664 * buffer in @skb must start with an IEEE 802.11 header or a radiotap 1664 * buffer in @skb must start with an IEEE 802.11 header.
1665 * header if %RX_FLAG_RADIOTAP is set in the @status flags.
1666 * 1665 *
1667 * This function may not be called in IRQ context. Calls to this function 1666 * This function may not be called in IRQ context. Calls to this function
1668 * for a single hardware must be synchronized against each other. Calls to 1667 * for a single hardware must be synchronized against each other. Calls to
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 14f10eb91c5c..8495161b99b8 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -214,8 +214,8 @@ static int ieee80211_open(struct net_device *dev)
214 /* must be before the call to ieee80211_configure_filter */ 214 /* must be before the call to ieee80211_configure_filter */
215 local->monitors++; 215 local->monitors++;
216 if (local->monitors == 1) { 216 if (local->monitors == 1) {
217 local->hw.conf.flags |= IEEE80211_CONF_RADIOTAP; 217 local->hw.conf.flags |= IEEE80211_CONF_MONITOR;
218 hw_reconf_flags |= IEEE80211_CONF_CHANGE_RADIOTAP; 218 hw_reconf_flags |= IEEE80211_CONF_CHANGE_MONITOR;
219 } 219 }
220 220
221 if (sdata->u.mntr_flags & MONITOR_FLAG_FCSFAIL) 221 if (sdata->u.mntr_flags & MONITOR_FLAG_FCSFAIL)
@@ -435,8 +435,8 @@ static int ieee80211_stop(struct net_device *dev)
435 435
436 local->monitors--; 436 local->monitors--;
437 if (local->monitors == 0) { 437 if (local->monitors == 0) {
438 local->hw.conf.flags &= ~IEEE80211_CONF_RADIOTAP; 438 local->hw.conf.flags &= ~IEEE80211_CONF_MONITOR;
439 hw_reconf_flags |= IEEE80211_CONF_CHANGE_RADIOTAP; 439 hw_reconf_flags |= IEEE80211_CONF_CHANGE_MONITOR;
440 } 440 }
441 441
442 if (sdata->u.mntr_flags & MONITOR_FLAG_FCSFAIL) 442 if (sdata->u.mntr_flags & MONITOR_FLAG_FCSFAIL)
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 01df328530ad..798fa82b6ae3 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -39,11 +39,8 @@ static u8 ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw,
39 * only useful for monitoring. 39 * only useful for monitoring.
40 */ 40 */
41static struct sk_buff *remove_monitor_info(struct ieee80211_local *local, 41static struct sk_buff *remove_monitor_info(struct ieee80211_local *local,
42 struct sk_buff *skb, 42 struct sk_buff *skb)
43 int rtap_len)
44{ 43{
45 skb_pull(skb, rtap_len);
46
47 if (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS) { 44 if (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS) {
48 if (likely(skb->len > FCS_LEN)) 45 if (likely(skb->len > FCS_LEN))
49 skb_trim(skb, skb->len - FCS_LEN); 46 skb_trim(skb, skb->len - FCS_LEN);
@@ -59,15 +56,14 @@ static struct sk_buff *remove_monitor_info(struct ieee80211_local *local,
59} 56}
60 57
61static inline int should_drop_frame(struct sk_buff *skb, 58static inline int should_drop_frame(struct sk_buff *skb,
62 int present_fcs_len, 59 int present_fcs_len)
63 int radiotap_len)
64{ 60{
65 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); 61 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
66 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 62 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
67 63
68 if (status->flag & (RX_FLAG_FAILED_FCS_CRC | RX_FLAG_FAILED_PLCP_CRC)) 64 if (status->flag & (RX_FLAG_FAILED_FCS_CRC | RX_FLAG_FAILED_PLCP_CRC))
69 return 1; 65 return 1;
70 if (unlikely(skb->len < 16 + present_fcs_len + radiotap_len)) 66 if (unlikely(skb->len < 16 + present_fcs_len))
71 return 1; 67 return 1;
72 if (ieee80211_is_ctl(hdr->frame_control) && 68 if (ieee80211_is_ctl(hdr->frame_control) &&
73 !ieee80211_is_pspoll(hdr->frame_control) && 69 !ieee80211_is_pspoll(hdr->frame_control) &&
@@ -225,7 +221,6 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb,
225 struct sk_buff *skb, *skb2; 221 struct sk_buff *skb, *skb2;
226 struct net_device *prev_dev = NULL; 222 struct net_device *prev_dev = NULL;
227 int present_fcs_len = 0; 223 int present_fcs_len = 0;
228 int rtap_len = 0;
229 224
230 /* 225 /*
231 * First, we may need to make a copy of the skb because 226 * First, we may need to make a copy of the skb because
@@ -235,25 +230,23 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb,
235 * We don't need to, of course, if we aren't going to return 230 * We don't need to, of course, if we aren't going to return
236 * the SKB because it has a bad FCS/PLCP checksum. 231 * the SKB because it has a bad FCS/PLCP checksum.
237 */ 232 */
238 if (status->flag & RX_FLAG_RADIOTAP) 233
239 rtap_len = ieee80211_get_radiotap_len(origskb->data); 234 /* room for the radiotap header based on driver features */
240 else 235 needed_headroom = ieee80211_rx_radiotap_len(local, status);
241 /* room for the radiotap header based on driver features */
242 needed_headroom = ieee80211_rx_radiotap_len(local, status);
243 236
244 if (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS) 237 if (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS)
245 present_fcs_len = FCS_LEN; 238 present_fcs_len = FCS_LEN;
246 239
247 if (!local->monitors) { 240 if (!local->monitors) {
248 if (should_drop_frame(origskb, present_fcs_len, rtap_len)) { 241 if (should_drop_frame(origskb, present_fcs_len)) {
249 dev_kfree_skb(origskb); 242 dev_kfree_skb(origskb);
250 return NULL; 243 return NULL;
251 } 244 }
252 245
253 return remove_monitor_info(local, origskb, rtap_len); 246 return remove_monitor_info(local, origskb);
254 } 247 }
255 248
256 if (should_drop_frame(origskb, present_fcs_len, rtap_len)) { 249 if (should_drop_frame(origskb, present_fcs_len)) {
257 /* only need to expand headroom if necessary */ 250 /* only need to expand headroom if necessary */
258 skb = origskb; 251 skb = origskb;
259 origskb = NULL; 252 origskb = NULL;
@@ -277,16 +270,14 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb,
277 */ 270 */
278 skb = skb_copy_expand(origskb, needed_headroom, 0, GFP_ATOMIC); 271 skb = skb_copy_expand(origskb, needed_headroom, 0, GFP_ATOMIC);
279 272
280 origskb = remove_monitor_info(local, origskb, rtap_len); 273 origskb = remove_monitor_info(local, origskb);
281 274
282 if (!skb) 275 if (!skb)
283 return origskb; 276 return origskb;
284 } 277 }
285 278
286 /* if necessary, prepend radiotap information */ 279 /* prepend radiotap information */
287 if (!(status->flag & RX_FLAG_RADIOTAP)) 280 ieee80211_add_rx_radiotap_header(local, skb, rate, needed_headroom);
288 ieee80211_add_rx_radiotap_header(local, skb, rate,
289 needed_headroom);
290 281
291 skb_reset_mac_header(skb); 282 skb_reset_mac_header(skb);
292 skb->ip_summed = CHECKSUM_UNNECESSARY; 283 skb->ip_summed = CHECKSUM_UNNECESSARY;