diff options
author | Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de> | 2013-07-08 10:55:52 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2013-07-16 02:58:05 -0400 |
commit | a5e70697d0c4836e69c60de92db27eac9ae71e05 (patch) | |
tree | a4af8f2f829b505a2e78aafb2aa9663e25709b7b | |
parent | 438b61b77082e70d2a408cc77b8c5faac312e940 (diff) |
mac80211: add radiotap flag and handling for 5/10 MHz
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>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
-rw-r--r-- | include/net/ieee80211_radiotap.h | 4 | ||||
-rw-r--r-- | include/net/mac80211.h | 4 | ||||
-rw-r--r-- | 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 c6d07cb074bc..8b5b71433297 100644 --- a/include/net/ieee80211_radiotap.h +++ b/include/net/ieee80211_radiotap.h | |||
@@ -230,6 +230,10 @@ enum ieee80211_radiotap_type { | |||
230 | #define IEEE80211_CHAN_PASSIVE 0x0200 /* Only passive scan allowed */ | 230 | #define IEEE80211_CHAN_PASSIVE 0x0200 /* Only passive scan allowed */ |
231 | #define IEEE80211_CHAN_DYN 0x0400 /* Dynamic CCK-OFDM channel */ | 231 | #define IEEE80211_CHAN_DYN 0x0400 /* Dynamic CCK-OFDM channel */ |
232 | #define IEEE80211_CHAN_GFSK 0x0800 /* GFSK channel (FHSS PHY) */ | 232 | #define IEEE80211_CHAN_GFSK 0x0800 /* GFSK channel (FHSS PHY) */ |
233 | #define IEEE80211_CHAN_GSM 0x1000 /* GSM (900 MHz) */ | ||
234 | #define IEEE80211_CHAN_STURBO 0x2000 /* Static Turbo */ | ||
235 | #define IEEE80211_CHAN_HALF 0x4000 /* Half channel (10 MHz wide) */ | ||
236 | #define IEEE80211_CHAN_QUARTER 0x8000 /* Quarter channel (5 MHz wide) */ | ||
233 | 237 | ||
234 | /* For IEEE80211_RADIOTAP_FLAGS */ | 238 | /* For IEEE80211_RADIOTAP_FLAGS */ |
235 | #define IEEE80211_RADIOTAP_F_CFP 0x01 /* sent/received | 239 | #define IEEE80211_RADIOTAP_F_CFP 0x01 /* sent/received |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index fe5fee830aa8..3124036285eb 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) | |||
811 | * @RX_FLAG_AMPDU_DELIM_CRC_KNOWN: The delimiter CRC field is known (the CRC | 811 | * @RX_FLAG_AMPDU_DELIM_CRC_KNOWN: The delimiter CRC field is known (the CRC |
812 | * is stored in the @ampdu_delimiter_crc field) | 812 | * is stored in the @ampdu_delimiter_crc field) |
813 | * @RX_FLAG_STBC_MASK: STBC 2 bit bitmask. 1 - Nss=1, 2 - Nss=2, 3 - Nss=3 | 813 | * @RX_FLAG_STBC_MASK: STBC 2 bit bitmask. 1 - Nss=1, 2 - Nss=2, 3 - Nss=3 |
814 | * @RX_FLAG_10MHZ: 10 MHz (half channel) was used | ||
815 | * @RX_FLAG_5MHZ: 5 MHz (quarter channel) was used | ||
814 | */ | 816 | */ |
815 | enum mac80211_rx_flags { | 817 | enum mac80211_rx_flags { |
816 | RX_FLAG_MMIC_ERROR = BIT(0), | 818 | RX_FLAG_MMIC_ERROR = BIT(0), |
@@ -839,6 +841,8 @@ enum mac80211_rx_flags { | |||
839 | RX_FLAG_80P80MHZ = BIT(24), | 841 | RX_FLAG_80P80MHZ = BIT(24), |
840 | RX_FLAG_160MHZ = BIT(25), | 842 | RX_FLAG_160MHZ = BIT(25), |
841 | RX_FLAG_STBC_MASK = BIT(26) | BIT(27), | 843 | RX_FLAG_STBC_MASK = BIT(26) | BIT(27), |
844 | RX_FLAG_10MHZ = BIT(28), | ||
845 | RX_FLAG_5MHZ = BIT(29), | ||
842 | }; | 846 | }; |
843 | 847 | ||
844 | #define RX_FLAG_STBC_SHIFT 26 | 848 | #define RX_FLAG_STBC_SHIFT 26 |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index c9f2ca43856a..deeeca1299bd 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -159,6 +159,7 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local, | |||
159 | __le32 *it_present; | 159 | __le32 *it_present; |
160 | u32 it_present_val; | 160 | u32 it_present_val; |
161 | u16 rx_flags = 0; | 161 | u16 rx_flags = 0; |
162 | u16 channel_flags = 0; | ||
162 | int mpdulen, chain; | 163 | int mpdulen, chain; |
163 | unsigned long chains = status->chains; | 164 | unsigned long chains = status->chains; |
164 | 165 | ||
@@ -243,20 +244,22 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local, | |||
243 | /* IEEE80211_RADIOTAP_CHANNEL */ | 244 | /* IEEE80211_RADIOTAP_CHANNEL */ |
244 | put_unaligned_le16(status->freq, pos); | 245 | put_unaligned_le16(status->freq, pos); |
245 | pos += 2; | 246 | pos += 2; |
247 | if (status->flag & RX_FLAG_10MHZ) | ||
248 | channel_flags |= IEEE80211_CHAN_HALF; | ||
249 | else if (status->flag & RX_FLAG_5MHZ) | ||
250 | channel_flags |= IEEE80211_CHAN_QUARTER; | ||
251 | |||
246 | if (status->band == IEEE80211_BAND_5GHZ) | 252 | if (status->band == IEEE80211_BAND_5GHZ) |
247 | put_unaligned_le16(IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5GHZ, | 253 | channel_flags |= IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5GHZ; |
248 | pos); | ||
249 | else if (status->flag & (RX_FLAG_HT | RX_FLAG_VHT)) | 254 | else if (status->flag & (RX_FLAG_HT | RX_FLAG_VHT)) |
250 | put_unaligned_le16(IEEE80211_CHAN_DYN | IEEE80211_CHAN_2GHZ, | 255 | channel_flags |= IEEE80211_CHAN_DYN | IEEE80211_CHAN_2GHZ; |
251 | pos); | ||
252 | else if (rate && rate->flags & IEEE80211_RATE_ERP_G) | 256 | else if (rate && rate->flags & IEEE80211_RATE_ERP_G) |
253 | put_unaligned_le16(IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ, | 257 | channel_flags |= IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ; |
254 | pos); | ||
255 | else if (rate) | 258 | else if (rate) |
256 | put_unaligned_le16(IEEE80211_CHAN_CCK | IEEE80211_CHAN_2GHZ, | 259 | channel_flags |= IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ; |
257 | pos); | ||
258 | else | 260 | else |
259 | put_unaligned_le16(IEEE80211_CHAN_2GHZ, pos); | 261 | channel_flags |= IEEE80211_CHAN_2GHZ; |
262 | put_unaligned_le16(channel_flags, pos); | ||
260 | pos += 2; | 263 | pos += 2; |
261 | 264 | ||
262 | /* IEEE80211_RADIOTAP_DBM_ANTSIGNAL */ | 265 | /* IEEE80211_RADIOTAP_DBM_ANTSIGNAL */ |