From: Jouni Malinen <jouni.malinen@atheros.com>
To: "John W. Linville" <linville@tuxdriver.com>,
Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org,
Jouni Malinen <jouni.malinen@atheros.com>
Subject: [PATCH 3/3] mac80211: Add HT rates into radiotap
Date: Fri, 12 Dec 2008 14:38:35 +0200 [thread overview]
Message-ID: <20081212123918.723191687@atheros.com> (raw)
In-Reply-To: 20081212123832.506588839@atheros.com
Update the radiotap definition based on the format used in FreeBSD to
allows MCS index, HT20/HT40, and short GI information to be reported
for received frames in monitor mode. This format is also supported by
wireshark.
Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>
---
include/net/ieee80211_radiotap.h | 7 +++++--
net/mac80211/rx.c | 28 ++++++++++++----------------
2 files changed, 17 insertions(+), 18 deletions(-)
--- wireless-testing.orig/include/net/ieee80211_radiotap.h 2008-12-04 12:56:59.000000000 +0200
+++ wireless-testing/include/net/ieee80211_radiotap.h 2008-12-12 14:10:02.000000000 +0200
@@ -100,9 +100,10 @@ struct ieee80211_radiotap_header {
* For frequency-hopping radios, the hop set (first byte)
* and pattern (second byte).
*
- * IEEE80211_RADIOTAP_RATE u8 500kb/s
+ * IEEE80211_RADIOTAP_RATE u8 500kb/s or index
*
- * Tx/Rx data rate
+ * Tx/Rx data rate. If bit 0x80 is set then it represents an
+ * an MCS index and not an IEEE rate.
*
* IEEE80211_RADIOTAP_DBM_ANTSIGNAL s8 decibels from
* one milliwatt (dBm)
@@ -230,6 +231,8 @@ enum ieee80211_radiotap_type {
* 802.11 header and payload
* (to 32-bit boundary)
*/
+#define IEEE80211_RADIOTAP_F_SHORTGI 0x80 /* HT short GI */
+
/* For IEEE80211_RADIOTAP_RX_FLAGS */
#define IEEE80211_RADIOTAP_F_RX_BADFCS 0x0001 /* frame failed crc check */
--- wireless-testing.orig/net/mac80211/rx.c 2008-12-12 14:09:52.000000000 +0200
+++ wireless-testing/net/mac80211/rx.c 2008-12-12 14:10:02.000000000 +0200
@@ -116,6 +116,7 @@ ieee80211_add_rx_radiotap_header(struct
{
struct ieee80211_radiotap_header *rthdr;
unsigned char *pos;
+ u16 chan_flags;
rthdr = (struct ieee80211_radiotap_header *)skb_push(skb, rtap_len);
memset(rthdr, 0, rtap_len);
@@ -146,19 +147,14 @@ ieee80211_add_rx_radiotap_header(struct
*pos |= IEEE80211_RADIOTAP_F_FCS;
if (status->flag & RX_FLAG_SHORTPRE)
*pos |= IEEE80211_RADIOTAP_F_SHORTPRE;
+ if (status->flag & RX_FLAG_SHORT_GI)
+ *pos |= IEEE80211_RADIOTAP_F_SHORTGI;
pos++;
/* IEEE80211_RADIOTAP_RATE */
- if (status->flag & RX_FLAG_HT) {
- /*
- * TODO: add following information into radiotap header once
- * suitable fields are defined for it:
- * - MCS index (status->rate_idx)
- * - HT40 (status->flag & RX_FLAG_40MHZ)
- * - short-GI (status->flag & RX_FLAG_SHORT_GI)
- */
- *pos = 0;
- } else
+ if (status->flag & RX_FLAG_HT)
+ *pos = 0x80 | status->rate_idx;
+ else
*pos = rate->bitrate / 5;
pos++;
@@ -166,14 +162,14 @@ ieee80211_add_rx_radiotap_header(struct
*(__le16 *)pos = cpu_to_le16(status->freq);
pos += 2;
if (status->band == IEEE80211_BAND_5GHZ)
- *(__le16 *)pos = cpu_to_le16(IEEE80211_CHAN_OFDM |
- IEEE80211_CHAN_5GHZ);
+ chan_flags = IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5GHZ;
else if (rate->flags & IEEE80211_RATE_ERP_G)
- *(__le16 *)pos = cpu_to_le16(IEEE80211_CHAN_OFDM |
- IEEE80211_CHAN_2GHZ);
+ chan_flags = IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ;
else
- *(__le16 *)pos = cpu_to_le16(IEEE80211_CHAN_CCK |
- IEEE80211_CHAN_2GHZ);
+ chan_flags = IEEE80211_CHAN_CCK | IEEE80211_CHAN_2GHZ;
+ if (status->flag & RX_FLAG_40MHZ)
+ chan_flags |= IEEE80211_CHAN_TURBO;
+ *(__le16 *) pos = cpu_to_le16(chan_flags);
pos += 2;
/* IEEE80211_RADIOTAP_DBM_ANTSIGNAL */
--
--
Jouni Malinen PGP id EFC895FA
next prev parent reply other threads:[~2008-12-12 12:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-12 12:38 [PATCH 0/3] mac80211: HT rate reporting in RX status Jouni Malinen
2008-12-12 12:38 ` [PATCH 1/3] mac80211: Add HT rates into RX status reporting Jouni Malinen
2008-12-12 15:47 ` Johannes Berg
2008-12-12 12:38 ` [PATCH 2/3] ath9k: Report HT rates in RX status Jouni Malinen
2008-12-12 12:38 ` Jouni Malinen [this message]
2008-12-12 14:47 ` [PATCH 3/3] mac80211: Add HT rates into radiotap Stefanik Gábor
2008-12-12 14:48 ` Johannes Berg
2008-12-12 15:16 ` Jouni Malinen
2008-12-12 15:31 ` Henning Rogge
2008-12-12 16:34 ` Jouni Malinen
2008-12-12 15:50 ` Johannes Berg
2008-12-12 15:49 ` 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=20081212123918.723191687@atheros.com \
--to=jouni.malinen@atheros.com \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
/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).