radiotap.netbsd.org archive mirror
 help / color / mirror / Atom feed
From: Matteo Croce <technoboy85-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Roberto Riggio <roberto.riggio-2TmCWn7/4sHOQU1ULcgDhA@public.gmane.org>
Cc: Johannes Berg <johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>,
	radiotap-sUITvd46vNxg9hUCZPvPmw@public.gmane.org
Subject: Re: MCS field: RFA
Date: Thu, 21 Apr 2011 17:04:06 +0200	[thread overview]
Message-ID: <BANLkTi=psWmOSJXDRQvGC2ABwYfR=8EFrg@mail.gmail.com> (raw)
In-Reply-To: <4DAEDBAB.5070100-2TmCWn7/4sHOQU1ULcgDhA@public.gmane.org>

This patch allows to set the tx rate and retries when injecting,
and report correct MCS information on received frames.

Signed-off-by: Matteo Croce <matteo-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>

--- a/net/mac80211/tx.c	2011-04-18 15:30:13.540573589 +0200
+++ b/net/mac80211/tx.c	2011-04-19 16:17:19.072552828 +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-18 15:30:13.532573589 +0200
+++ b/net/mac80211/ieee80211_i.h	2011-04-18 17:06:47.904572241 +0200
@@ -1196,6 +1196,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-18 15:30:13.548573589 +0200
+++ b/net/mac80211/status.c	2011-04-18 17:23:40.560572005 +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-18 15:30:13.524573589 +0200
+++ b/net/wireless/radiotap.c	2011-04-18 16:11:36.044573011 +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
 	 */

  parent reply	other threads:[~2011-04-21 15:04 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-26 14:26 MCS field: RFA Matteo Croce
     [not found] ` <40101cc31001260626g4a47b7c6gde6f99e477e69ac9-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-01-26 17:47   ` David Young
     [not found]     ` <20100126174728.GV1060-eZodSLrBbDpBDgjK7y7TUQ@public.gmane.org>
2010-01-27  9:36       ` Johannes Berg
     [not found]         ` <1264584965.25642.15.camel-YfaajirXv2244ywRPIzf9A@public.gmane.org>
2010-01-27 15:30           ` David Young
     [not found]             ` <20100127153002.GC1060-eZodSLrBbDpBDgjK7y7TUQ@public.gmane.org>
2010-01-27 15:32               ` Matteo Croce
2010-02-01 22:09                 ` Bill Stafford
     [not found]                   ` <loom.20100201T230554-2-eS7Uydv5nfjZ+VzJOa5vwg@public.gmane.org>
2010-02-02 18:24                     ` Johannes Berg
2010-02-02 19:54                     ` David Young
     [not found]                       ` <20100202195424.GE1060-eZodSLrBbDpBDgjK7y7TUQ@public.gmane.org>
2010-02-03  5:24                         ` Bill Stafford
     [not found]                           ` <C33B109A-9A6C-4931-8A69-5147A418E8B5-BUHhN+a2lJ4@public.gmane.org>
2010-02-04  1:11                             ` Joshua (Shiwei) Zhao
     [not found]                               ` <d521a2311002031711i4293ae26i8c460aa3f41997e6-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-02-04  5:50                                 ` Bill Stafford
     [not found]                                   ` <1F39C830-A521-456A-A5FA-2FC97914A74A-BUHhN+a2lJ4@public.gmane.org>
2010-02-04  6:14                                     ` Joshua (Shiwei) Zhao
2010-03-25 23:50                         ` David Young
     [not found]                           ` <20100325235000.GX414-eZodSLrBbDpBDgjK7y7TUQ@public.gmane.org>
2010-03-26  4:57                             ` Johannes Berg
     [not found]                               ` <1269579436.4581.0.camel-8upI4CBIZJIJvtFkdXX2HixXY32XiHfO@public.gmane.org>
2010-08-09 12:10                                 ` Johannes Berg
2010-02-02 17:36 ` Bill Stafford
     [not found]   ` <loom.20100202T174119-204-eS7Uydv5nfjZ+VzJOa5vwg@public.gmane.org>
2010-02-02 18:20     ` Johannes Berg
2010-02-02 18:24     ` David Young
2010-02-06 20:02 ` MCS field: RFA (wireshark patch) Bill Stafford
     [not found]   ` <loom.20100206T204036-824-eS7Uydv5nfjZ+VzJOa5vwg@public.gmane.org>
2010-02-06 20:31     ` Johannes Berg
2011-04-18  9:49 ` MCS field: RFA Roberto Riggio
     [not found]   ` <loom.20110418T114722-716-eS7Uydv5nfjZ+VzJOa5vwg@public.gmane.org>
2011-04-18 10:01     ` Johannes Berg
     [not found]       ` <1303120873.3588.5.camel-8upI4CBIZJIJvtFkdXX2HixXY32XiHfO@public.gmane.org>
2011-04-18 10:06         ` Roberto Riggio
     [not found]           ` <BANLkTikV_YxYnFxjHrFE7XgYfi1T7J=3Tw@mail.gmail.com>
     [not found]             ` <BANLkTikV_YxYnFxjHrFE7XgYfi1T7J=3Tw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-04-20 13:12               ` Roberto Riggio
     [not found]                 ` <4DAEDBAB.5070100-2TmCWn7/4sHOQU1ULcgDhA@public.gmane.org>
2011-04-21 15:04                   ` Matteo Croce [this message]
     [not found]                     ` <BANLkTi=psWmOSJXDRQvGC2ABwYfR=8EFrg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-04-22  7:07                       ` Roberto Riggio
2010-08-30 21:21 Bill Stafford

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='BANLkTi=psWmOSJXDRQvGC2ABwYfR=8EFrg@mail.gmail.com' \
    --to=technoboy85-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org \
    --cc=radiotap-sUITvd46vNxg9hUCZPvPmw@public.gmane.org \
    --cc=roberto.riggio-2TmCWn7/4sHOQU1ULcgDhA@public.gmane.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).