linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Implementation of the IEEE80211_RADIOTAP_RATE option
@ 2009-08-21  0:40 Rafael Laufer
  2009-08-21  8:18 ` Johannes Berg
  0 siblings, 1 reply; 15+ messages in thread
From: Rafael Laufer @ 2009-08-21  0:40 UTC (permalink / raw)
  To: linux-wireless

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 <rlaufer@cs.ucla.edu>
---
 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
-- 
1.6.0.4


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2009-08-23  9:11 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-21  0:40 [PATCH] Implementation of the IEEE80211_RADIOTAP_RATE option Rafael Laufer
2009-08-21  8:18 ` Johannes Berg
2009-08-21 13:30   ` Gábor Stefanik
2009-08-21 18:03     ` Rafael Laufer
2009-08-21 18:52       ` Gábor Stefanik
2009-08-21 19:06         ` Rafael Laufer
2009-08-21 19:57           ` Gábor Stefanik
2009-08-21 20:21             ` Rafael Laufer
2009-08-21 20:24               ` Rafael Laufer
2009-08-22  7:50               ` Johannes Berg
2009-08-22 22:05                 ` Rafael Laufer
2009-08-22  7:48       ` Johannes Berg
2009-08-22 22:03         ` Rafael Laufer
2009-08-23  8:06           ` Kalle Valo
2009-08-23  9:11           ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).