From: Matteo Croce <matteo@openwrt.org>
To: linux-wireless@vger.kernel.org
Subject: [PATCH 1/2]: mac80211: set tx rate and retries when injecting
Date: Fri, 20 May 2011 01:13:01 +0200 [thread overview]
Message-ID: <BANLkTin6ettB1nhnrAjDncX1MrahfS4Z6g@mail.gmail.com> (raw)
Allow to set the tx rate and retries when injecting:
read the information from the radiotap header and populate the retry chain
Signed-off-by: Matteo Croce <matteo@openwrt.org>
--- a/net/mac80211/tx.c 2011-05-20 00:22:56.250640264 +0200
+++ b/net/mac80211/tx.c 2011-05-20 00:24:14.010640270 +0200
@@ -1092,6 +1092,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-05-20 00:22:56.240640264 +0200
+++ b/net/mac80211/ieee80211_i.h 2011-05-20 00:24:14.010640270 +0200
@@ -1217,6 +1217,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/wireless/radiotap.c 2011-05-20 00:22:56.270640264 +0200
+++ b/net/wireless/radiotap.c 2011-05-20 00:24:14.010640270 +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-05-20 00:22:56.210640264 +0200
+++ b/include/net/mac80211.h 2011-05-20 00:24:14.020640270 +0200
@@ -2278,7 +2278,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
next reply other threads:[~2011-05-19 23:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-19 23:13 Matteo Croce [this message]
2011-05-20 10:07 ` [PATCH 1/2]: mac80211: set tx rate and retries when injecting Roberto Riggio
2011-05-23 0:30 ` Matteo Croce
2011-05-23 6:59 ` Roberto Riggio
2011-05-20 15: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=BANLkTin6ettB1nhnrAjDncX1MrahfS4Z6g@mail.gmail.com \
--to=matteo@openwrt.org \
--cc=linux-wireless@vger.kernel.org \
/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).