mac80211: skip radiotap space calculation if no monitor exists
authorHelmut Schaa <helmut.schaa@googlemail.com>
Wed, 5 Dec 2012 13:36:12 +0000 (14:36 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 5 Dec 2012 15:54:59 +0000 (16:54 +0100)
The radiotap header length "needed_headroom" is only required if we're
sending the skb to a monitor interface. Hence, move the calculation a
bit later so the calculation can be skipped if no monitor interface is
present.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/rx.c

index db343fa8033cad55cbadbbb4296e3e566b8229e3..e4ee3274899433a8c8d91898ee0430aa03bf5d56 100644 (file)
@@ -378,9 +378,6 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb,
         * the SKB because it has a bad FCS/PLCP checksum.
         */
 
-       /* room for the radiotap header based on driver features */
-       needed_headroom = ieee80211_rx_radiotap_space(local, status);
-
        if (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS)
                present_fcs_len = FCS_LEN;
 
@@ -399,6 +396,9 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb,
                return remove_monitor_info(local, origskb);
        }
 
+       /* room for the radiotap header based on driver features */
+       needed_headroom = ieee80211_rx_radiotap_space(local, status);
+
        if (should_drop_frame(origskb, present_fcs_len)) {
                /* only need to expand headroom if necessary */
                skb = origskb;