This patch allows to set the tx rate and retries when injecting,
and report correct MCS information on received frames.
This v2 version sets IEEE80211_TX_STATUS_HEADROOM to a correct value
Signed-off-by: Matteo Croce <[email protected]>
--- a/net/mac80211/tx.c 2011-04-22 11:34:08.825135198 +0200
+++ b/net/mac80211/tx.c 2011-04-22 11:34:54.037135187 +0200
@@ -1091,6 +1091,44 @@
tx->flags |= IEEE80211_TX_FRAGMENTED;
break;
+ case IEEE80211_RADIOTAP_RATE: {
+ info->control.rates[0].idx = 0;
+ if (*iterator.this_arg) {
+ int i;
+ for (i = 0; i < sband->n_bitrates; i++)
+ if (sband->bitrates[i].bitrate ==
+ *iterator.this_arg * 5) {
+ info->control.rates[0].idx = i;
+ break;
+ }
+ }
+ info->control.rates[0].flags = 0;
+ info->control.rates[1].idx = -1;
+ info->control.rates[2].idx = -1;
+ info->control.rates[3].idx = -1;
+ info->control.rates[4].idx = -1;
+ break;
+ }
+
+ case IEEE80211_RADIOTAP_DATA_RETRIES:
+ info->control.rates[0].count = *iterator.this_arg;
+ break;
+
+ case IEEE80211_RADIOTAP_MCS: {
+ u8 flags = iterator.this_arg[1];
+ u8 mcs = iterator.this_arg[2];
+ info->control.rates[0].idx = mcs;
+ info->control.rates[0].flags |=
+ IEEE80211_TX_RC_MCS;
+ if (flags & IEEE80211_RADIOTAP_MCS_BW_40)
+ info->control.rates[0].flags |=
+ IEEE80211_TX_RC_40_MHZ_WIDTH;
+ if (flags & IEEE80211_RADIOTAP_MCS_SGI)
+ info->control.rates[0].flags |=
+ IEEE80211_TX_RC_SHORT_GI;
+ break;
+ }
+
/*
* Please update the file
* Documentation/networking/mac80211-injection.txt
--- a/net/mac80211/ieee80211_i.h 2011-04-22 11:34:08.829135198 +0200
+++ b/net/mac80211/ieee80211_i.h 2011-04-22 11:34:54.037135187 +0200
@@ -1197,6 +1197,10 @@
u8 padding_for_rate;
__le16 tx_flags;
u8 data_retries;
+ /*HT info*/
+ u8 ht_known;
+ u8 ht_flag;
+ u8 ht_mcs;
} __packed;
--- a/net/mac80211/status.c 2011-04-22 11:34:08.833135198 +0200
+++ b/net/mac80211/status.c 2011-04-22 11:34:54.037135187 +0200
@@ -405,6 +405,19 @@
!(info->status.rates[0].flags & IEEE80211_TX_RC_MCS))
rthdr->rate = sband->bitrates[
info->status.rates[0].idx].bitrate / 5;
+ /* HT rates */
+ if (info->status.rates[0].flags & IEEE80211_TX_RC_MCS) {
+ rthdr->hdr.it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_MCS);
+ rthdr->rate = 0;
+ rthdr->ht_known = IEEE80211_RADIOTAP_MCS_HAVE_BW |
+ IEEE80211_RADIOTAP_MCS_HAVE_MCS |
+ IEEE80211_RADIOTAP_MCS_HAVE_GI;
+ rthdr->ht_mcs = info->status.rates[0].idx;
+ if (info->status.rates[0].flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
+ rthdr->ht_flag |= IEEE80211_RADIOTAP_MCS_BW_40;
+ if (info->status.rates[0].flags & IEEE80211_TX_RC_SHORT_GI)
+ rthdr->ht_flag |= IEEE80211_RADIOTAP_MCS_SGI;
+ }
/* for now report the total retry_count */
rthdr->data_retries = retry_count;
--- a/net/wireless/radiotap.c 2011-04-22 11:34:08.833135198 +0200
+++ b/net/wireless/radiotap.c 2011-04-22 11:34:54.037135187 +0200
@@ -40,6 +40,7 @@
[IEEE80211_RADIOTAP_TX_FLAGS] = { .align = 2, .size = 2, },
[IEEE80211_RADIOTAP_RTS_RETRIES] = { .align = 1, .size = 1, },
[IEEE80211_RADIOTAP_DATA_RETRIES] = { .align = 1, .size = 1, },
+ [IEEE80211_RADIOTAP_MCS] = { .align = 1, .size = 3, },
/*
* add more here as they are defined in radiotap.h
*/
--- a/include/net/mac80211.h 2011-04-22 11:38:01.389135142 +0200
+++ b/include/net/mac80211.h 2011-04-22 11:40:22.017135111 +0200
@@ -2228,7 +2228,7 @@
* The TX headroom reserved by mac80211 for its own tx_status functions.
* This is enough for the radiotap header.
*/
-#define IEEE80211_TX_STATUS_HEADROOM 13
+#define IEEE80211_TX_STATUS_HEADROOM 16
/**
* ieee80211_sta_set_tim - set the TIM bit for a sleeping station
On Fri, 2011-04-22 at 18:34 +0200, Matteo Croce wrote:
> This patch allows to set the tx rate and retries when injecting,
> and report correct MCS information on received frames.
This description is wrong. It doesn't touch rx.c, does it?
johannes
On Sun, 2011-04-24 at 10:15 +0200, Johannes Berg wrote:
> On Fri, 2011-04-22 at 18:34 +0200, Matteo Croce wrote:
> > This patch allows to set the tx rate and retries when injecting,
> > and report correct MCS information on received frames.
>
> This description is wrong. It doesn't touch rx.c, does it?
It does appear to touch radiotap processing, and I bet the developer
tested this, but other than that don't know.
>
> johannes
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Best regards,
Maxim Levitsky
Visit my blog: http://maximlevitsky.wordpress.com
Warning: Above blog contains rants.
2011/4/24 Maxim Levitsky <[email protected]>:
> On Sun, 2011-04-24 at 10:15 +0200, Johannes Berg wrote:
>> On Fri, 2011-04-22 at 18:34 +0200, Matteo Croce wrote:
>> > This patch allows to set the tx rate and retries when injecting,
>> > and report correct MCS information on received frames.
>>
>> This description is wrong. It doesn't touch rx.c, does it?
>
> It does appear to touch radiotap processing, and I bet the developer
> tested this, but other than that don't know.
>
>>
>> johannes
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
>> the body of a message to [email protected]
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
> --
> Best regards,
> Maxim Levitsky
>
> Visit my blog: http://maximlevitsky.wordpress.com
> Warning: Above blog contains rants.
>
>
The old patch added RX processing but now all it's merged in mainline
and the only piece left in rx.c was:
--- a/net/mac80211/rx.c 2011-04-21 19:08:26.253148959 +0200
+++ b/net/mac80211/rx.c 2011-04-22 11:56:24.257134886 +0200
@@ -195,6 +195,7 @@
put_unaligned_le16(rx_flags, pos);
pos += 2;
+ /* IEEE80211_RADIOTAP_RATE_MCS */
if (status->flag & RX_FLAG_HT) {
rthdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_MCS);
*pos++ = IEEE80211_RADIOTAP_MCS_HAVE_MCS |
so I decided to remove this chunk, but I forget the original description
--
Matteo Croce
OpenWrt Developer
_______ ________ __
| |.-----.-----.-----.| | | |.----.| |_
| - || _ | -__| || | | || _|| _|
|_______|| __|_____|__|__||________||__| |____|
|__| W I R E L E S S F R E E D O M
ATTITUDE ADJUSTMENT (bleeding edge) --------------
* 1/4 oz Vodka Pour all ingredents into mixing
* 1/4 oz Gin tin with ice, strain into glass.
* 1/4 oz Amaretto
* 1/4 oz Triple sec
* 1/4 oz Peach schnapps
* 1/4 oz Sour mix
* 1 splash Cranberry juice
-----------------------------------------------------
CC [M] net/mac80211/tx.o
net/mac80211/tx.c: In function ‘__ieee80211_parse_tx_radiotap’:
net/mac80211/tx.c:1095:21: error: ‘sband’ undeclared (first use in this function)
net/mac80211/tx.c:1095:21: note: each undeclared identifier is reported only once for each function it appears in
Also, please add "mac80211:" as a prefix in the subject, and correct
the commit message to not reference received frames.
On Fri, Apr 22, 2011 at 06:34:59PM +0200, Matteo Croce wrote:
> This patch allows to set the tx rate and retries when injecting,
> and report correct MCS information on received frames.
> This v2 version sets IEEE80211_TX_STATUS_HEADROOM to a correct value
>
> Signed-off-by: Matteo Croce <[email protected]>
>
> --- a/net/mac80211/tx.c 2011-04-22 11:34:08.825135198 +0200
> +++ b/net/mac80211/tx.c 2011-04-22 11:34:54.037135187 +0200
> @@ -1091,6 +1091,44 @@
> tx->flags |= IEEE80211_TX_FRAGMENTED;
> break;
>
> + case IEEE80211_RADIOTAP_RATE: {
> + info->control.rates[0].idx = 0;
> + if (*iterator.this_arg) {
> + int i;
> + for (i = 0; i < sband->n_bitrates; i++)
> + if (sband->bitrates[i].bitrate ==
> + *iterator.this_arg * 5) {
> + info->control.rates[0].idx = i;
> + break;
> + }
> + }
> + info->control.rates[0].flags = 0;
> + info->control.rates[1].idx = -1;
> + info->control.rates[2].idx = -1;
> + info->control.rates[3].idx = -1;
> + info->control.rates[4].idx = -1;
> + break;
> + }
> +
> + case IEEE80211_RADIOTAP_DATA_RETRIES:
> + info->control.rates[0].count = *iterator.this_arg;
> + break;
> +
> + case IEEE80211_RADIOTAP_MCS: {
> + u8 flags = iterator.this_arg[1];
> + u8 mcs = iterator.this_arg[2];
> + info->control.rates[0].idx = mcs;
> + info->control.rates[0].flags |=
> + IEEE80211_TX_RC_MCS;
> + if (flags & IEEE80211_RADIOTAP_MCS_BW_40)
> + info->control.rates[0].flags |=
> + IEEE80211_TX_RC_40_MHZ_WIDTH;
> + if (flags & IEEE80211_RADIOTAP_MCS_SGI)
> + info->control.rates[0].flags |=
> + IEEE80211_TX_RC_SHORT_GI;
> + break;
> + }
> +
> /*
> * Please update the file
> * Documentation/networking/mac80211-injection.txt
> --- a/net/mac80211/ieee80211_i.h 2011-04-22 11:34:08.829135198 +0200
> +++ b/net/mac80211/ieee80211_i.h 2011-04-22 11:34:54.037135187 +0200
> @@ -1197,6 +1197,10 @@
> u8 padding_for_rate;
> __le16 tx_flags;
> u8 data_retries;
> + /*HT info*/
> + u8 ht_known;
> + u8 ht_flag;
> + u8 ht_mcs;
> } __packed;
>
>
> --- a/net/mac80211/status.c 2011-04-22 11:34:08.833135198 +0200
> +++ b/net/mac80211/status.c 2011-04-22 11:34:54.037135187 +0200
> @@ -405,6 +405,19 @@
> !(info->status.rates[0].flags & IEEE80211_TX_RC_MCS))
> rthdr->rate = sband->bitrates[
> info->status.rates[0].idx].bitrate / 5;
> + /* HT rates */
> + if (info->status.rates[0].flags & IEEE80211_TX_RC_MCS) {
> + rthdr->hdr.it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_MCS);
> + rthdr->rate = 0;
> + rthdr->ht_known = IEEE80211_RADIOTAP_MCS_HAVE_BW |
> + IEEE80211_RADIOTAP_MCS_HAVE_MCS |
> + IEEE80211_RADIOTAP_MCS_HAVE_GI;
> + rthdr->ht_mcs = info->status.rates[0].idx;
> + if (info->status.rates[0].flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
> + rthdr->ht_flag |= IEEE80211_RADIOTAP_MCS_BW_40;
> + if (info->status.rates[0].flags & IEEE80211_TX_RC_SHORT_GI)
> + rthdr->ht_flag |= IEEE80211_RADIOTAP_MCS_SGI;
> + }
>
> /* for now report the total retry_count */
> rthdr->data_retries = retry_count;
> --- a/net/wireless/radiotap.c 2011-04-22 11:34:08.833135198 +0200
> +++ b/net/wireless/radiotap.c 2011-04-22 11:34:54.037135187 +0200
> @@ -40,6 +40,7 @@
> [IEEE80211_RADIOTAP_TX_FLAGS] = { .align = 2, .size = 2, },
> [IEEE80211_RADIOTAP_RTS_RETRIES] = { .align = 1, .size = 1, },
> [IEEE80211_RADIOTAP_DATA_RETRIES] = { .align = 1, .size = 1, },
> + [IEEE80211_RADIOTAP_MCS] = { .align = 1, .size = 3, },
> /*
> * add more here as they are defined in radiotap.h
> */
> --- a/include/net/mac80211.h 2011-04-22 11:38:01.389135142 +0200
> +++ b/include/net/mac80211.h 2011-04-22 11:40:22.017135111 +0200
> @@ -2228,7 +2228,7 @@
> * The TX headroom reserved by mac80211 for its own tx_status functions.
> * This is enough for the radiotap header.
> */
> -#define IEEE80211_TX_STATUS_HEADROOM 13
> +#define IEEE80211_TX_STATUS_HEADROOM 16
>
> /**
> * ieee80211_sta_set_tim - set the TIM bit for a sleeping station
>
--
John W. Linville Someday the world will need a hero, and you
[email protected] might be all we have. Be ready.
On Sun, 2011-05-15 at 00:07 +0200, Matteo Croce wrote:
> >> + rthdr->ht_mcs = info->status.rates[0].idx;
> >> + if (info->status.rates[0].flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
> >> + rthdr->ht_flag |= IEEE80211_RADIOTAP_MCS_BW_40;
> >> + if (info->status.rates[0].flags & IEEE80211_TX_RC_SHORT_GI)
> >> + rthdr->ht_flag |= IEEE80211_RADIOTAP_MCS_SGI;
> >> + }
> >
> > I think you should also split the patch -- this part isn't really only
> > injection.
> After injecting a frame I have a TX feedback, why shouldn't it have
> correct MCS informations?
... yeah but I said it's not _only_ injection, you also have TX feedback
w/o injection, so this isn't injection related.
johannes
2011/5/11 Johannes Berg <[email protected]>:
> On Fri, 2011-04-22 at 18:34 +0200, Matteo Croce wrote:
>
>> --- a/net/mac80211/status.c 2011-04-22 11:34:08.833135198 +0200
>> +++ b/net/mac80211/status.c 2011-04-22 11:34:54.037135187 +0200
>> @@ -405,6 +405,19 @@
>> !(info->status.rates[0].flags & IEEE80211_TX_RC_MCS))
>> rthdr->rate = sband->bitrates[
>> info->status.rates[0].idx].bitrate / 5;
>> + /* HT rates */
>> + if (info->status.rates[0].flags & IEEE80211_TX_RC_MCS) {
>> + rthdr->hdr.it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_MCS);
>> + rthdr->rate = 0;
>> + rthdr->ht_known = IEEE80211_RADIOTAP_MCS_HAVE_BW |
>> + IEEE80211_RADIOTAP_MCS_HAVE_MCS |
>> + IEEE80211_RADIOTAP_MCS_HAVE_GI;
>> + rthdr->ht_mcs = info->status.rates[0].idx;
>> + if (info->status.rates[0].flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
>> + rthdr->ht_flag |= IEEE80211_RADIOTAP_MCS_BW_40;
>> + if (info->status.rates[0].flags & IEEE80211_TX_RC_SHORT_GI)
>> + rthdr->ht_flag |= IEEE80211_RADIOTAP_MCS_SGI;
>> + }
>
> I think you should also split the patch -- this part isn't really only
> injection.
>
> johannes
>
>
After injecting a frame I have a TX feedback, why shouldn't it have
correct MCS informations?
--
Matteo Croce
OpenWrt Developer
_______ ________ __
| |.-----.-----.-----.| | | |.----.| |_
| - || _ | -__| || | | || _|| _|
|_______|| __|_____|__|__||________||__| |____|
|__| W I R E L E S S F R E E D O M
ATTITUDE ADJUSTMENT (bleeding edge) --------------
* 1/4 oz Vodka Pour all ingredents into mixing
* 1/4 oz Gin tin with ice, strain into glass.
* 1/4 oz Amaretto
* 1/4 oz Triple sec
* 1/4 oz Peach schnapps
* 1/4 oz Sour mix
* 1 splash Cranberry juice
-----------------------------------------------------
On Fri, 2011-04-22 at 18:34 +0200, Matteo Croce wrote:
> --- a/net/mac80211/status.c 2011-04-22 11:34:08.833135198 +0200
> +++ b/net/mac80211/status.c 2011-04-22 11:34:54.037135187 +0200
> @@ -405,6 +405,19 @@
> !(info->status.rates[0].flags & IEEE80211_TX_RC_MCS))
> rthdr->rate = sband->bitrates[
> info->status.rates[0].idx].bitrate / 5;
> + /* HT rates */
> + if (info->status.rates[0].flags & IEEE80211_TX_RC_MCS) {
> + rthdr->hdr.it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_MCS);
> + rthdr->rate = 0;
> + rthdr->ht_known = IEEE80211_RADIOTAP_MCS_HAVE_BW |
> + IEEE80211_RADIOTAP_MCS_HAVE_MCS |
> + IEEE80211_RADIOTAP_MCS_HAVE_GI;
> + rthdr->ht_mcs = info->status.rates[0].idx;
> + if (info->status.rates[0].flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
> + rthdr->ht_flag |= IEEE80211_RADIOTAP_MCS_BW_40;
> + if (info->status.rates[0].flags & IEEE80211_TX_RC_SHORT_GI)
> + rthdr->ht_flag |= IEEE80211_RADIOTAP_MCS_SGI;
> + }
I think you should also split the patch -- this part isn't really only
injection.
johannes