* [PATCH] mac80211: Parse IEEE80211_RADIOTAP_RATE on TX
@ 2014-07-10 12:27 Rostislav Lisovy
2014-07-21 10:20 ` Johannes Berg
0 siblings, 1 reply; 4+ messages in thread
From: Rostislav Lisovy @ 2014-07-10 12:27 UTC (permalink / raw)
To: Johannes Berg, John W. Linville, linux-wireless, linux-kernel
Cc: Michal Sojka, s.sander, jan-niklas.meier, Rostislav Lisovy
Add support for parsing radiotap field IEEE80211_RADIOTAP_RATE
for transmitted frames. Use the provided datarate value in
info->control.rates[] array so it will be used for transmission.
Signed-off-by: Rostislav Lisovy <rostislav.lisovy@fel.cvut.cz>
---
This feature is essential for Transmit Datarate Control (TDC)
in future implementation of IEEE 802.11-2012 "Wireless Access
for the Vehicular Environment" support.
include/net/mac80211.h | 2 ++
net/mac80211/rate.c | 4 ++++
net/mac80211/tx.c | 43 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 49 insertions(+)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 9ce5cb1..7ba8faa 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -549,11 +549,13 @@ enum mac80211_tx_info_flags {
*
* @IEEE80211_TX_CTRL_PORT_CTRL_PROTO: this frame is a port control
* protocol frame (e.g. EAP)
+ * @IEEE80211_TX_CTRL_USERRATE: Fixed datarate set by the user
*
* These flags are used in tx_info->control.flags.
*/
enum mac80211_tx_control_flags {
IEEE80211_TX_CTRL_PORT_CTRL_PROTO = BIT(0),
+ IEEE80211_TX_CTRL_USERRATE = BIT(1),
};
/*
diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c
index 8fdadfd..1111dee 100644
--- a/net/mac80211/rate.c
+++ b/net/mac80211/rate.c
@@ -673,6 +673,10 @@ void rate_control_get_rate(struct ieee80211_sub_if_data *sdata,
priv_sta = sta->rate_ctrl_priv;
}
+ if ((info->flags & IEEE80211_TX_CTL_INJECTED) &&
+ (info->control.flags & IEEE80211_TX_CTRL_USERRATE))
+ return;
+
for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
info->control.rates[i].idx = -1;
info->control.rates[i].flags = 0;
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 865bdaf..2099c70 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1541,7 +1541,11 @@ static bool ieee80211_parse_tx_radiotap(struct sk_buff *skb)
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len,
NULL);
+ struct ieee80211_sub_if_data *sdata;
+ struct ieee80211_supported_band *sband;
+ int rate;
u16 txflags;
+ int i, j;
info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT |
IEEE80211_TX_CTL_DONTFRAG;
@@ -1592,6 +1596,45 @@ static bool ieee80211_parse_tx_radiotap(struct sk_buff *skb)
info->flags |= IEEE80211_TX_CTL_NO_ACK;
break;
+ case IEEE80211_RADIOTAP_RATE:
+ if (!(*iterator.this_arg))
+ break;
+
+ rate = 0;
+ sdata = vif_to_sdata(info->control.vif);
+ sband = sdata->wdev.wiphy->bands[info->band];
+ for (i = 0; i < sband->n_bitrates; i++) {
+ /* Radiotap datarate: Units of 500 Kbps
+ * ieee80211_rate.bitrate: Units of 100 Kbps
+ */
+ if ((sband->bitrates[i].bitrate * 2) ==
+ ((*iterator.this_arg) * 10)) {
+ rate = i;
+ break;
+ }
+ }
+
+ if (!rate)
+ break;
+
+ info->flags |= IEEE80211_TX_CTRL_USERRATE;
+
+ for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
+ if (info->control.rates[i].idx < 0)
+ break;
+
+ /* Rate masking supports only legacy
+ * rates for now
+ */
+ if (info->control.rates[i].flags &
+ IEEE80211_TX_RC_MCS)
+ continue;
+
+ for (j = 0; j < sband->n_bitrates; j++)
+ info->control.rates[i].idx = rate;
+ }
+ break;
+
/*
* Please update the file
* Documentation/networking/mac80211-injection.txt
--
2.0.0.rc4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mac80211: Parse IEEE80211_RADIOTAP_RATE on TX
2014-07-10 12:27 [PATCH] mac80211: Parse IEEE80211_RADIOTAP_RATE on TX Rostislav Lisovy
@ 2014-07-21 10:20 ` Johannes Berg
2014-08-25 7:52 ` Rostislav Lisovy
0 siblings, 1 reply; 4+ messages in thread
From: Johannes Berg @ 2014-07-21 10:20 UTC (permalink / raw)
To: Rostislav Lisovy
Cc: John W. Linville, linux-wireless, linux-kernel, Michal Sojka,
s.sander, jan-niklas.meier, Rostislav Lisovy
On Thu, 2014-07-10 at 14:27 +0200, Rostislav Lisovy wrote:
> Add support for parsing radiotap field IEEE80211_RADIOTAP_RATE
> for transmitted frames. Use the provided datarate value in
> info->control.rates[] array so it will be used for transmission.
>
> Signed-off-by: Rostislav Lisovy <rostislav.lisovy@fel.cvut.cz>
> ---
> This feature is essential for Transmit Datarate Control (TDC)
> in future implementation of IEEE 802.11-2012 "Wireless Access
> for the Vehicular Environment" support.
It seems like an extremely bad idea to base your implementation of WAVE
on monitor mode with injection.
Why can't you add a proper datapath?
johannes
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mac80211: Parse IEEE80211_RADIOTAP_RATE on TX
2014-07-21 10:20 ` Johannes Berg
@ 2014-08-25 7:52 ` Rostislav Lisovy
2014-08-29 11:12 ` Johannes Berg
0 siblings, 1 reply; 4+ messages in thread
From: Rostislav Lisovy @ 2014-08-25 7:52 UTC (permalink / raw)
To: Johannes Berg
Cc: John W. Linville, linux-wireless, linux-kernel, Michal Sojka,
s.sander, jan-niklas.meier, Rostislav Lisovy
On Mon, 2014-07-21 at 12:20 +0200, Johannes Berg wrote:
> On Thu, 2014-07-10 at 14:27 +0200, Rostislav Lisovy wrote:
> > Add support for parsing radiotap field IEEE80211_RADIOTAP_RATE
> > for transmitted frames. Use the provided datarate value in
> > info->control.rates[] array so it will be used for transmission.
> >
> > Signed-off-by: Rostislav Lisovy <rostislav.lisovy@fel.cvut.cz>
> > ---
> > This feature is essential for Transmit Datarate Control (TDC)
> > in future implementation of IEEE 802.11-2012 "Wireless Access
> > for the Vehicular Environment" support.
>
> It seems like an extremely bad idea to base your implementation of WAVE
> on monitor mode with injection.
>
> Why can't you add a proper datapath?
>
You are right. I was overthinking the per-packet datarate setting a
little bit.
If I am not mistaken it is not possible to say that this feature may be
useful as the general method for monitor-mode injection with datarate
until there is some user-space utility really using/needing it?
Best regards;
Rostislav
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mac80211: Parse IEEE80211_RADIOTAP_RATE on TX
2014-08-25 7:52 ` Rostislav Lisovy
@ 2014-08-29 11:12 ` Johannes Berg
0 siblings, 0 replies; 4+ messages in thread
From: Johannes Berg @ 2014-08-29 11:12 UTC (permalink / raw)
To: Rostislav Lisovy
Cc: John W. Linville, linux-wireless, linux-kernel, Michal Sojka,
s.sander, jan-niklas.meier, Rostislav Lisovy
On Mon, 2014-08-25 at 09:52 +0200, Rostislav Lisovy wrote:
> If I am not mistaken it is not possible to say that this feature may be
> useful as the general method for monitor-mode injection with datarate
> until there is some user-space utility really using/needing it?
Yes, this wasn't as much a comment on the patch as rather on your
implied approach for your userspace :)
That said, it's tricky, be cause much hardware doesn't allow to do this.
Maybe we should then have a feature flag or so rather than silently
ignoring the data?
johannes
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-08-29 11:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-10 12:27 [PATCH] mac80211: Parse IEEE80211_RADIOTAP_RATE on TX Rostislav Lisovy
2014-07-21 10:20 ` Johannes Berg
2014-08-25 7:52 ` Rostislav Lisovy
2014-08-29 11:12 ` Johannes Berg
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.