linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rafael Laufer <rlaufer@cs.ucla.edu>
To: "Gábor Stefanik" <netrolller.3d@gmail.com>
Cc: Johannes Berg <johannes@sipsolutions.net>,
	linux-wireless@vger.kernel.org
Subject: Re: [PATCH] Implementation of the IEEE80211_RADIOTAP_RATE option
Date: Fri, 21 Aug 2009 11:03:46 -0700	[thread overview]
Message-ID: <4A8EE182.6040709@cs.ucla.edu> (raw)
In-Reply-To: <69e28c910908210630m47eda1eegcd502c212736decd@mail.gmail.com>

Gábor Stefanik wrote:
> 
> Maybe a new IEEE80211_TX_CTL_ or IEEE80211_TX_RC_ flag will also be
> needed, so Radiotap can indicate whether rate_control_get_rate needs
> to be called.

ok, I am resending the patch. I included a new flag called 
IEEE80211_TX_CTL_RATE_RADIOTAP to indicate if the rate has
been set in the radiotap header. If not, then the rate control
algorithm is called.

Note that in the future there must be other flags like this to 
indicate if other parameters, such as power, was also set in
the radiotap header.


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. A new
 flag IEEE80211_TX_CTL_RATE_RADIOTAP is also
 included to indicate that the rate was set in
 the radiotap header and therefore the rate
 control algorithm should not change it.

 include/net/mac80211.h |    4 ++++
 net/mac80211/tx.c      |   22 +++++++++++++++++++++-
 2 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index aac84d7..819b01e 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -272,6 +272,9 @@ struct ieee80211_bss_conf {
  *	transmit function after the current frame, this can be used
  *	by drivers to kick the DMA queue only if unset or when the
  *	queue gets full.
+ * @IEEE80211_TX_CTL_RATE_RADIOTAP: completely internal to mac80211,
+ *	used to indicate that the rate was defined in the received radiotap
+ *	header and therefore the rate control algorithm should not change it.
  */
 enum mac80211_tx_control_flags {
 	IEEE80211_TX_CTL_REQ_TX_STATUS		= BIT(0),
@@ -293,6 +296,7 @@ enum mac80211_tx_control_flags {
 	IEEE80211_TX_INTFL_DONT_ENCRYPT		= BIT(16),
 	IEEE80211_TX_CTL_PSPOLL_RESPONSE	= BIT(17),
 	IEEE80211_TX_CTL_MORE_FRAMES		= BIT(18),
+	IEEE80211_TX_CTL_RATE_RADIOTAP 		= BIT(19),
 };
 
 /**
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 10a1099..f675844 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -549,7 +549,12 @@ 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, if the IEEE80211_RADIOTAP_RATE option is set in 
+	 * the received radiotap header, do not call the rate control algorithm.
+	 */
+	if (likely(!(info->flags & IEEE80211_TX_CTL_RATE_RADIOTAP)))
+		rate_control_get_rate(tx->sdata, tx->sta, &txrc);
 
 	if (unlikely(info->control.rates[0].idx < 0))
 		return TX_DROP;
@@ -972,6 +977,21 @@ 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;
+				info->flags |= IEEE80211_TX_CTL_RATE_RADIOTAP;
+			}
+			break;
+
 		/*
 		 * Please update the file
 		 * Documentation/networking/mac80211-injection.txt
-- 
1.6.0.4


  reply	other threads:[~2009-08-21 18:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A8EE182.6040709@cs.ucla.edu \
    --to=rlaufer@cs.ucla.edu \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netrolller.3d@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).