From: Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org,
Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>,
Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Subject: [PATCHv6 04/18] mac80211: add radiotap flag and handling for 5/10 MHz
Date: Mon, 8 Jul 2013 16:55:52 +0200 [thread overview]
Message-ID: <1373295366-12823-5-git-send-email-siwu@hrz.tu-chemnitz.de> (raw)
In-Reply-To: <1373295366-12823-1-git-send-email-siwu@hrz.tu-chemnitz.de>
Wireshark already defines radiotap channel flags for 5 and 10 MHz, so
just use them in Linux radiotap too. Furthermore, add rx status flags to
allow drivers to report when they received data on 5 or 10 MHz channels.
Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
---
include/net/ieee80211_radiotap.h | 4 ++++
include/net/mac80211.h | 4 ++++
net/mac80211/rx.c | 21 ++++++++++++---------
3 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/include/net/ieee80211_radiotap.h b/include/net/ieee80211_radiotap.h
index c6d07cb..8b5b714 100644
--- a/include/net/ieee80211_radiotap.h
+++ b/include/net/ieee80211_radiotap.h
@@ -230,6 +230,10 @@ enum ieee80211_radiotap_type {
#define IEEE80211_CHAN_PASSIVE 0x0200 /* Only passive scan allowed */
#define IEEE80211_CHAN_DYN 0x0400 /* Dynamic CCK-OFDM channel */
#define IEEE80211_CHAN_GFSK 0x0800 /* GFSK channel (FHSS PHY) */
+#define IEEE80211_CHAN_GSM 0x1000 /* GSM (900 MHz) */
+#define IEEE80211_CHAN_STURBO 0x2000 /* Static Turbo */
+#define IEEE80211_CHAN_HALF 0x4000 /* Half channel (10 MHz wide) */
+#define IEEE80211_CHAN_QUARTER 0x8000 /* Quarter channel (5 MHz wide) */
/* For IEEE80211_RADIOTAP_FLAGS */
#define IEEE80211_RADIOTAP_F_CFP 0x01 /* sent/received
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index b0e6872..bae1a78 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -811,6 +811,8 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
* @RX_FLAG_AMPDU_DELIM_CRC_KNOWN: The delimiter CRC field is known (the CRC
* is stored in the @ampdu_delimiter_crc field)
* @RX_FLAG_STBC_MASK: STBC 2 bit bitmask. 1 - Nss=1, 2 - Nss=2, 3 - Nss=3
+ * @RX_FLAG_10MHZ: 10 MHz (half channel) was used
+ * @RX_FLAG_5MHZ: 5 MHz (quarter channel) was used
*/
enum mac80211_rx_flags {
RX_FLAG_MMIC_ERROR = BIT(0),
@@ -839,6 +841,8 @@ enum mac80211_rx_flags {
RX_FLAG_80P80MHZ = BIT(24),
RX_FLAG_160MHZ = BIT(25),
RX_FLAG_STBC_MASK = BIT(26) | BIT(27),
+ RX_FLAG_10MHZ = BIT(28),
+ RX_FLAG_5MHZ = BIT(29),
};
#define RX_FLAG_STBC_SHIFT 26
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 23dbcfc..5f02aba 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -146,6 +146,7 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local,
struct ieee80211_radiotap_header *rthdr;
unsigned char *pos;
u16 rx_flags = 0;
+ u16 channel_flags = 0;
int mpdulen;
mpdulen = skb->len;
@@ -215,20 +216,22 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local,
/* IEEE80211_RADIOTAP_CHANNEL */
put_unaligned_le16(status->freq, pos);
pos += 2;
+ if (status->flag & RX_FLAG_10MHZ)
+ channel_flags |= IEEE80211_CHAN_HALF;
+ else if (status->flag & RX_FLAG_5MHZ)
+ channel_flags |= IEEE80211_CHAN_QUARTER;
+
if (status->band == IEEE80211_BAND_5GHZ)
- put_unaligned_le16(IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5GHZ,
- pos);
+ channel_flags |= IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5GHZ;
else if (status->flag & (RX_FLAG_HT | RX_FLAG_VHT))
- put_unaligned_le16(IEEE80211_CHAN_DYN | IEEE80211_CHAN_2GHZ,
- pos);
+ channel_flags |= IEEE80211_CHAN_DYN | IEEE80211_CHAN_2GHZ;
else if (rate && rate->flags & IEEE80211_RATE_ERP_G)
- put_unaligned_le16(IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ,
- pos);
+ channel_flags |= IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ;
else if (rate)
- put_unaligned_le16(IEEE80211_CHAN_CCK | IEEE80211_CHAN_2GHZ,
- pos);
+ channel_flags |= IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ;
else
- put_unaligned_le16(IEEE80211_CHAN_2GHZ, pos);
+ channel_flags |= IEEE80211_CHAN_2GHZ;
+ put_unaligned_le16(channel_flags, pos);
pos += 2;
/* IEEE80211_RADIOTAP_DBM_ANTSIGNAL */
--
1.7.10.4
next prev parent reply other threads:[~2013-07-08 14:56 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-08 14:55 [PATCHv6 00/18] Add support for 5 and 10 MHz channels Simon Wunderlich
2013-07-08 14:55 ` [PATCHv6 01/18] nl80211: add scan width to bss and scan request structs Simon Wunderlich
2013-07-08 14:55 ` [PATCHv6 02/18] mac80211/rc80211: add chandef to rate initialization Simon Wunderlich
2013-07-08 14:55 ` [PATCHv6 03/18] mac80211: fix timing for 5 MHz and 10 MHz channels Simon Wunderlich
2013-07-08 14:55 ` Simon Wunderlich [this message]
2013-07-08 14:55 ` [PATCHv6 05/18] mac80211: select and adjust bitrates according to channel mode Simon Wunderlich
2013-07-08 14:55 ` [PATCHv6 06/18] cfg80211/mac80211: get mandatory rates based on scan width Simon Wunderlich
2013-07-08 14:55 ` [PATCHv6 07/18] cfg80211/mac80211: use reduced txpower for 5 and 10 MHz Simon Wunderlich
2013-07-08 14:55 ` [PATCHv6 08/18] mac80211: allow scanning for 5/10 MHz channels in IBSS Simon Wunderlich
2013-07-08 14:55 ` [PATCHv6 09/18] mac80211: return if IBSS chandef can not be used Simon Wunderlich
2013-07-08 14:55 ` [PATCHv6 10/18] nl80211: allow 5 and 10 MHz channels for IBSS Simon Wunderlich
2013-07-08 14:55 ` [PATCHv6 11/18] ath9k: always use SIFS times from OFDM for 5/10 MHz Simon Wunderlich
2013-07-08 14:56 ` [PATCHv6 12/18] ath9k: use chandef instead of channel_type Simon Wunderlich
2013-07-08 14:56 ` [PATCHv6 13/18] ath9k: report 5/10 MHz channels Simon Wunderlich
2013-07-08 14:56 ` [PATCHv6 14/18] ath9k: set 5/10 MHz supported channels and fix bitrate Simon Wunderlich
2013-07-08 14:56 ` [PATCHv6 15/18] ath9k: announce that ath9k supports 5/10 MHz Simon Wunderlich
2013-07-08 14:56 ` [PATCHv6 16/18] ath5k: report 5/10 MHz channels Simon Wunderlich
2013-07-08 14:56 ` [PATCHv6 17/18] ath5k: set 5/10 MHz supported channels and fix duration Simon Wunderlich
2013-07-08 14:56 ` [PATCHv6 18/18] ath5k: enable support for 5 MHz and 10 MHz channels Simon Wunderlich
2013-07-09 15:08 ` [PATCHv6 00/18] Add support for 5 " Johannes Berg
2013-07-09 15:29 ` Simon Wunderlich
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=1373295366-12823-5-git-send-email-siwu@hrz.tu-chemnitz.de \
--to=simon.wunderlich@s2003.tu-chemnitz.de \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=mathias.kretschmer@fokus.fraunhofer.de \
--cc=siwu@hrz.tu-chemnitz.de \
/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