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>
This commit is contained in:
Родитель
438b61b770
Коммит
a5e70697d0
|
@ -230,6 +230,10 @@ enum ieee80211_radiotap_type {
|
||||||
#define IEEE80211_CHAN_PASSIVE 0x0200 /* Only passive scan allowed */
|
#define IEEE80211_CHAN_PASSIVE 0x0200 /* Only passive scan allowed */
|
||||||
#define IEEE80211_CHAN_DYN 0x0400 /* Dynamic CCK-OFDM channel */
|
#define IEEE80211_CHAN_DYN 0x0400 /* Dynamic CCK-OFDM channel */
|
||||||
#define IEEE80211_CHAN_GFSK 0x0800 /* GFSK channel (FHSS PHY) */
|
#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 */
|
/* For IEEE80211_RADIOTAP_FLAGS */
|
||||||
#define IEEE80211_RADIOTAP_F_CFP 0x01 /* sent/received
|
#define IEEE80211_RADIOTAP_F_CFP 0x01 /* sent/received
|
||||||
|
|
|
@ -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
|
* @RX_FLAG_AMPDU_DELIM_CRC_KNOWN: The delimiter CRC field is known (the CRC
|
||||||
* is stored in the @ampdu_delimiter_crc field)
|
* 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_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 {
|
enum mac80211_rx_flags {
|
||||||
RX_FLAG_MMIC_ERROR = BIT(0),
|
RX_FLAG_MMIC_ERROR = BIT(0),
|
||||||
|
@ -839,6 +841,8 @@ enum mac80211_rx_flags {
|
||||||
RX_FLAG_80P80MHZ = BIT(24),
|
RX_FLAG_80P80MHZ = BIT(24),
|
||||||
RX_FLAG_160MHZ = BIT(25),
|
RX_FLAG_160MHZ = BIT(25),
|
||||||
RX_FLAG_STBC_MASK = BIT(26) | BIT(27),
|
RX_FLAG_STBC_MASK = BIT(26) | BIT(27),
|
||||||
|
RX_FLAG_10MHZ = BIT(28),
|
||||||
|
RX_FLAG_5MHZ = BIT(29),
|
||||||
};
|
};
|
||||||
|
|
||||||
#define RX_FLAG_STBC_SHIFT 26
|
#define RX_FLAG_STBC_SHIFT 26
|
||||||
|
|
|
@ -159,6 +159,7 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local,
|
||||||
__le32 *it_present;
|
__le32 *it_present;
|
||||||
u32 it_present_val;
|
u32 it_present_val;
|
||||||
u16 rx_flags = 0;
|
u16 rx_flags = 0;
|
||||||
|
u16 channel_flags = 0;
|
||||||
int mpdulen, chain;
|
int mpdulen, chain;
|
||||||
unsigned long chains = status->chains;
|
unsigned long chains = status->chains;
|
||||||
|
|
||||||
|
@ -243,20 +244,22 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local,
|
||||||
/* IEEE80211_RADIOTAP_CHANNEL */
|
/* IEEE80211_RADIOTAP_CHANNEL */
|
||||||
put_unaligned_le16(status->freq, pos);
|
put_unaligned_le16(status->freq, pos);
|
||||||
pos += 2;
|
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)
|
if (status->band == IEEE80211_BAND_5GHZ)
|
||||||
put_unaligned_le16(IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5GHZ,
|
channel_flags |= IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5GHZ;
|
||||||
pos);
|
|
||||||
else if (status->flag & (RX_FLAG_HT | RX_FLAG_VHT))
|
else if (status->flag & (RX_FLAG_HT | RX_FLAG_VHT))
|
||||||
put_unaligned_le16(IEEE80211_CHAN_DYN | IEEE80211_CHAN_2GHZ,
|
channel_flags |= IEEE80211_CHAN_DYN | IEEE80211_CHAN_2GHZ;
|
||||||
pos);
|
|
||||||
else if (rate && rate->flags & IEEE80211_RATE_ERP_G)
|
else if (rate && rate->flags & IEEE80211_RATE_ERP_G)
|
||||||
put_unaligned_le16(IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ,
|
channel_flags |= IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ;
|
||||||
pos);
|
|
||||||
else if (rate)
|
else if (rate)
|
||||||
put_unaligned_le16(IEEE80211_CHAN_CCK | IEEE80211_CHAN_2GHZ,
|
channel_flags |= IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ;
|
||||||
pos);
|
|
||||||
else
|
else
|
||||||
put_unaligned_le16(IEEE80211_CHAN_2GHZ, pos);
|
channel_flags |= IEEE80211_CHAN_2GHZ;
|
||||||
|
put_unaligned_le16(channel_flags, pos);
|
||||||
pos += 2;
|
pos += 2;
|
||||||
|
|
||||||
/* IEEE80211_RADIOTAP_DBM_ANTSIGNAL */
|
/* IEEE80211_RADIOTAP_DBM_ANTSIGNAL */
|
||||||
|
|
Загрузка…
Ссылка в новой задаче