diff options
-rw-r--r-- | include/net/ieee80211_radiotap.h | 25 | ||||
-rw-r--r-- | net/mac80211/rx.c | 17 |
2 files changed, 42 insertions, 0 deletions
diff --git a/include/net/ieee80211_radiotap.h b/include/net/ieee80211_radiotap.h index af49f8ab7f81..b0be5fb9de19 100644 --- a/include/net/ieee80211_radiotap.h +++ b/include/net/ieee80211_radiotap.h | |||
@@ -178,6 +178,11 @@ struct ieee80211_radiotap_header { | |||
178 | * | 178 | * |
179 | * Number of unicast retries a transmitted frame used. | 179 | * Number of unicast retries a transmitted frame used. |
180 | * | 180 | * |
181 | * IEEE80211_RADIOTAP_MCS u8, u8, u8 unitless | ||
182 | * | ||
183 | * Contains a bitmap of known fields/flags, the flags, and | ||
184 | * the MCS index. | ||
185 | * | ||
181 | */ | 186 | */ |
182 | enum ieee80211_radiotap_type { | 187 | enum ieee80211_radiotap_type { |
183 | IEEE80211_RADIOTAP_TSFT = 0, | 188 | IEEE80211_RADIOTAP_TSFT = 0, |
@@ -199,6 +204,8 @@ enum ieee80211_radiotap_type { | |||
199 | IEEE80211_RADIOTAP_RTS_RETRIES = 16, | 204 | IEEE80211_RADIOTAP_RTS_RETRIES = 16, |
200 | IEEE80211_RADIOTAP_DATA_RETRIES = 17, | 205 | IEEE80211_RADIOTAP_DATA_RETRIES = 17, |
201 | 206 | ||
207 | IEEE80211_RADIOTAP_MCS = 19, | ||
208 | |||
202 | /* valid in every it_present bitmap, even vendor namespaces */ | 209 | /* valid in every it_present bitmap, even vendor namespaces */ |
203 | IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE = 29, | 210 | IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE = 29, |
204 | IEEE80211_RADIOTAP_VENDOR_NAMESPACE = 30, | 211 | IEEE80211_RADIOTAP_VENDOR_NAMESPACE = 30, |
@@ -245,6 +252,24 @@ enum ieee80211_radiotap_type { | |||
245 | #define IEEE80211_RADIOTAP_F_TX_CTS 0x0002 /* used cts 'protection' */ | 252 | #define IEEE80211_RADIOTAP_F_TX_CTS 0x0002 /* used cts 'protection' */ |
246 | #define IEEE80211_RADIOTAP_F_TX_RTS 0x0004 /* used rts/cts handshake */ | 253 | #define IEEE80211_RADIOTAP_F_TX_RTS 0x0004 /* used rts/cts handshake */ |
247 | 254 | ||
255 | |||
256 | /* For IEEE80211_RADIOTAP_MCS */ | ||
257 | #define IEEE80211_RADIOTAP_MCS_HAVE_BW 0x01 | ||
258 | #define IEEE80211_RADIOTAP_MCS_HAVE_MCS 0x02 | ||
259 | #define IEEE80211_RADIOTAP_MCS_HAVE_GI 0x04 | ||
260 | #define IEEE80211_RADIOTAP_MCS_HAVE_FMT 0x08 | ||
261 | #define IEEE80211_RADIOTAP_MCS_HAVE_FEC 0x10 | ||
262 | |||
263 | #define IEEE80211_RADIOTAP_MCS_BW_MASK 0x03 | ||
264 | #define IEEE80211_RADIOTAP_MCS_BW_20 0 | ||
265 | #define IEEE80211_RADIOTAP_MCS_BW_40 1 | ||
266 | #define IEEE80211_RADIOTAP_MCS_BW_20L 2 | ||
267 | #define IEEE80211_RADIOTAP_MCS_BW_20U 3 | ||
268 | #define IEEE80211_RADIOTAP_MCS_SGI 0x04 | ||
269 | #define IEEE80211_RADIOTAP_MCS_FMT_GF 0x08 | ||
270 | #define IEEE80211_RADIOTAP_MCS_FEC_LDPC 0x10 | ||
271 | |||
272 | |||
248 | /* Ugly macro to convert literal channel numbers into their mhz equivalents | 273 | /* Ugly macro to convert literal channel numbers into their mhz equivalents |
249 | * There are certianly some conditions that will break this (like feeding it '30') | 274 | * There are certianly some conditions that will break this (like feeding it '30') |
250 | * but they shouldn't arise since nothing talks on channel 30. */ | 275 | * but they shouldn't arise since nothing talks on channel 30. */ |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index f36d70f5b062..7185c9316be2 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -85,6 +85,9 @@ ieee80211_rx_radiotap_len(struct ieee80211_local *local, | |||
85 | if (len & 1) /* padding for RX_FLAGS if necessary */ | 85 | if (len & 1) /* padding for RX_FLAGS if necessary */ |
86 | len++; | 86 | len++; |
87 | 87 | ||
88 | if (status->flag & RX_FLAG_HT) /* HT info */ | ||
89 | len += 3; | ||
90 | |||
88 | return len; | 91 | return len; |
89 | } | 92 | } |
90 | 93 | ||
@@ -193,6 +196,20 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local, | |||
193 | rx_flags |= IEEE80211_RADIOTAP_F_RX_BADPLCP; | 196 | rx_flags |= IEEE80211_RADIOTAP_F_RX_BADPLCP; |
194 | put_unaligned_le16(rx_flags, pos); | 197 | put_unaligned_le16(rx_flags, pos); |
195 | pos += 2; | 198 | pos += 2; |
199 | |||
200 | if (status->flag & RX_FLAG_HT) { | ||
201 | rthdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_MCS); | ||
202 | *pos++ = IEEE80211_RADIOTAP_MCS_HAVE_MCS | | ||
203 | IEEE80211_RADIOTAP_MCS_HAVE_GI | | ||
204 | IEEE80211_RADIOTAP_MCS_HAVE_BW; | ||
205 | *pos = 0; | ||
206 | if (status->flag & RX_FLAG_SHORT_GI) | ||
207 | *pos |= IEEE80211_RADIOTAP_MCS_SGI; | ||
208 | if (status->flag & RX_FLAG_40MHZ) | ||
209 | *pos |= IEEE80211_RADIOTAP_MCS_BW_40; | ||
210 | pos++; | ||
211 | *pos++ = status->rate_idx; | ||
212 | } | ||
196 | } | 213 | } |
197 | 214 | ||
198 | /* | 215 | /* |