2012-12-05 13:36:26

by Helmut Schaa

[permalink] [raw]
Subject: [PATCH] mac80211: Skip radiotap space calculation if no monitor exists

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 <[email protected]>
---
net/mac80211/rx.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 825f33c..a78afa1 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -338,9 +338,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;

@@ -359,6 +356,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;
--
1.7.7



2012-12-05 15:55:15

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] mac80211: Skip radiotap space calculation if no monitor exists

On Wed, 2012-12-05 at 14:36 +0100, Helmut Schaa wrote:
> 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.

Applied. If we didn't need "local" we could mark the function __pure and
the compiler would do this optimisation for us ;-))

johannes