diff mbox

Implementation of the IEEE80211_RADIOTAP_RATE option

Message ID 4A8DED03.2050502@cs.ucla.edu (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Rafael Laufer Aug. 21, 2009, 12:40 a.m. UTC
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(-)

Comments

Johannes Berg Aug. 21, 2009, 8:18 a.m. UTC | #1
On Thu, 2009-08-20 at 17:40 -0700, Rafael Laufer wrote:
> 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);

NAK, the rate is optional in the radiotap header, and if not given then
regular rate control must be used.

johannes
Gábor Stefanik Aug. 21, 2009, 1:30 p.m. UTC | #2
On Fri, Aug 21, 2009 at 10:18 AM, Johannes
Berg<johannes@sipsolutions.net> wrote:
> On Thu, 2009-08-20 at 17:40 -0700, Rafael Laufer wrote:
>> 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);
>
> NAK, the rate is optional in the radiotap header, and if not given then
> regular rate control must be used.
>
> johannes
>

Also, I think something more powerful than the current "rate" field
would be needed, with support for MCS indexes, channel width, retry
count, etc. - one that can configure all values rate_control_get_rate
would perform. I'm planning a Radiotap meeting on Freenode with the
radiotap.h maintainers in various OSes participating, so the field 14+
mess can be cleaned up once for all - that's when I'll probably
propose this field.

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.
diff mbox

Patch

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