From patchwork Fri Aug 21 00:40:35 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rafael Laufer X-Patchwork-Id: 43026 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n7L0ed1f031839 for ; Fri, 21 Aug 2009 00:40:39 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750948AbZHUAkg (ORCPT ); Thu, 20 Aug 2009 20:40:36 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751063AbZHUAkg (ORCPT ); Thu, 20 Aug 2009 20:40:36 -0400 Received: from sj-iport-1.cisco.com ([171.71.176.70]:35929 "EHLO sj-iport-1.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750937AbZHUAkf (ORCPT ); Thu, 20 Aug 2009 20:40:35 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEAHSKjUqrR7PE/2dsb2JhbAC+F4hjh3+ITIQYBYI8 X-IronPort-AV: E=Sophos;i="4.44,247,1249257600"; d="scan'208";a="230930341" Received: from sj-dkim-4.cisco.com ([171.71.179.196]) by sj-iport-1.cisco.com with ESMTP; 21 Aug 2009 00:40:37 +0000 Received: from sj-core-3.cisco.com (sj-core-3.cisco.com [171.68.223.137]) by sj-dkim-4.cisco.com (8.12.11/8.12.11) with ESMTP id n7L0eb2T019489 for ; Thu, 20 Aug 2009 17:40:37 -0700 Received: from xbh-sjc-221.amer.cisco.com (xbh-sjc-221.cisco.com [128.107.191.63]) by sj-core-3.cisco.com (8.13.8/8.14.3) with ESMTP id n7L0ebfn016450 for ; Fri, 21 Aug 2009 00:40:37 GMT Received: from xfe-sjc-212.amer.cisco.com ([171.70.151.187]) by xbh-sjc-221.amer.cisco.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 20 Aug 2009 17:40:37 -0700 Received: from [171.71.57.112] ([171.71.57.112]) by xfe-sjc-212.amer.cisco.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 20 Aug 2009 17:40:36 -0700 Message-ID: <4A8DED03.2050502@cs.ucla.edu> Date: Thu, 20 Aug 2009 17:40:35 -0700 From: Rafael Laufer User-Agent: Thunderbird 2.0.0.22 (X11/20090608) MIME-Version: 1.0 To: linux-wireless@vger.kernel.org Subject: [PATCH] Implementation of the IEEE80211_RADIOTAP_RATE option X-OriginalArrivalTime: 21 Aug 2009 00:40:36.0997 (UTC) FILETIME=[000D7B50:01CA21F8] Authentication-Results: sj-dkim-4; header.From=rlaufer@cs.ucla.edu; dkim=neutral Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org This patch implements the IEEE80211_RADIOTAP_RATE option when parsing radiotap headers to allow rate selection on a per-packet basis. Signed-off-by: Rafael Laufer --- Implementation of the IEEE80211_RADIOTAP_RATE option when parsing radiotap headers to allow rate selection on a per-packet basis. net/mac80211/tx.c | 18 +++++++++++++++++- 1 files changed, 17 insertions(+), 1 deletions(-) diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 10a1099..41d636b 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -549,7 +549,10 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx) * If we're associated with the sta at this point we know we can at * least send the frame at the lowest bit rate. */ - rate_control_get_rate(tx->sdata, tx->sta, &txrc); + + /* in monitor mode, we already have the rate from the radiotap header */ + if (likely(!(info->flags & IEEE80211_TX_CTL_INJECTED))) + rate_control_get_rate(tx->sdata, tx->sta, &txrc); if (unlikely(info->control.rates[0].idx < 0)) return TX_DROP; @@ -972,6 +975,19 @@ static bool __ieee80211_parse_tx_radiotap(struct ieee80211_tx_data *tx, tx->flags |= IEEE80211_TX_FRAGMENTED; break; + /* Get the rate parameter from the radiotap header, + * allowing rate selection on a per-packet basis + */ + case IEEE80211_RADIOTAP_RATE: + bitrate = (*iterator.this_arg) * 5; + for (i = 0; i < sband->n_bitrates; i++) { + if (sband->bitrates[i].bitrate == bitrate) + break; + } + if (i != sband->n_bitrates) + info->control.rates[0].idx = i; + break; + /* * Please update the file * Documentation/networking/mac80211-injection.txt