From patchwork Wed Dec 5 13:36:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helmut Schaa X-Patchwork-Id: 1841301 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 311CF3FCF2 for ; Wed, 5 Dec 2012 13:36:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754131Ab2LENg1 (ORCPT ); Wed, 5 Dec 2012 08:36:27 -0500 Received: from mail-ee0-f46.google.com ([74.125.83.46]:40809 "EHLO mail-ee0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753842Ab2LENg0 (ORCPT ); Wed, 5 Dec 2012 08:36:26 -0500 Received: by mail-ee0-f46.google.com with SMTP id e53so2917020eek.19 for ; Wed, 05 Dec 2012 05:36:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=E3XJAKycCm3SRtnv9MnmokMGOaZKc254rvw8OrDHFSM=; b=P/J4K/EntySATT9Jdtnr8RB53h6eNnt4iVq5FlX0jvqaGiNa6hBsVQyco27tcm9t8c jiXYJVJznGhflM/DiL9Y0+5sSVf9RNP/+Tv6ghr+OAbqMGP6ybUWFE0DjnBgf2cs+lNO i8kQ0/jhCM/ROJS3ZfDiHGSVblUsVs06tz8Xy/9JMKldxNe1Apt139vcDg/S4zq9SOc1 KOFfJr2CDyhocj+q42mgDGPY9ewwrykvGsm3BqZeoVsJOJm14StNfB1up6lRGLnbpRSH Qx0Ddi3NlEY6Y1kWc3JrLqC55RZ/YPLGMXl5h7RnJAoCl1Vpeqndl+To8UAi3KL10X7w H/ww== Received: by 10.14.0.71 with SMTP id 47mr60238768eea.19.1354714585347; Wed, 05 Dec 2012 05:36:25 -0800 (PST) Received: from localhost.localdomain (port-92-198-130-130.static.qsc.de. [92.198.130.130]) by mx.google.com with ESMTPS id e1sm9288076eem.3.2012.12.05.05.36.24 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 05 Dec 2012 05:36:24 -0800 (PST) From: Helmut Schaa To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Helmut Schaa Subject: [PATCH] mac80211: Skip radiotap space calculation if no monitor exists Date: Wed, 5 Dec 2012 14:36:12 +0100 Message-Id: <1354714572-26995-1-git-send-email-helmut.schaa@googlemail.com> X-Mailer: git-send-email 1.7.7 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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 --- 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;