diff mbox

mac80211: Skip radiotap space calculation if no monitor exists

Message ID 1354714572-26995-1-git-send-email-helmut.schaa@googlemail.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Helmut Schaa Dec. 5, 2012, 1:36 p.m. UTC
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>
---
 net/mac80211/rx.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

Comments

Johannes Berg Dec. 5, 2012, 3:55 p.m. UTC | #1
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

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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;