提交 3b23c184 编写于 作者: T Thomas Pedersen 提交者: Johannes Berg

mac80211: add freq_offset to RX status

RX status needs a KHz component, so add freq_offset. We
can reduce the bits for the frequency since 60 GHz isn't
supported.
Signed-off-by: NThomas Pedersen <thomas@adapt-ip.com>
Link: https://lore.kernel.org/r/20200402011810.22947-5-thomas@adapt-ip.com
[fix commit message]
Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
上级 b6011960
...@@ -1335,6 +1335,7 @@ enum mac80211_rx_encoding { ...@@ -1335,6 +1335,7 @@ enum mac80211_rx_encoding {
* @freq: frequency the radio was tuned to when receiving this frame, in MHz * @freq: frequency the radio was tuned to when receiving this frame, in MHz
* This field must be set for management frames, but isn't strictly needed * This field must be set for management frames, but isn't strictly needed
* for data (other) frames - for those it only affects radiotap reporting. * for data (other) frames - for those it only affects radiotap reporting.
* @freq_offset: @freq has a positive offset of 500Khz.
* @signal: signal strength when receiving this frame, either in dBm, in dB or * @signal: signal strength when receiving this frame, either in dBm, in dB or
* unspecified depending on the hardware capabilities flags * unspecified depending on the hardware capabilities flags
* @IEEE80211_HW_SIGNAL_* * @IEEE80211_HW_SIGNAL_*
...@@ -1365,7 +1366,7 @@ struct ieee80211_rx_status { ...@@ -1365,7 +1366,7 @@ struct ieee80211_rx_status {
u32 device_timestamp; u32 device_timestamp;
u32 ampdu_reference; u32 ampdu_reference;
u32 flag; u32 flag;
u16 freq; u16 freq: 13, freq_offset: 1;
u8 enc_flags; u8 enc_flags;
u8 encoding:2, bw:3, he_ru:3; u8 encoding:2, bw:3, he_ru:3;
u8 he_gi:2, he_dcm:1; u8 he_gi:2, he_dcm:1;
...@@ -1381,6 +1382,13 @@ struct ieee80211_rx_status { ...@@ -1381,6 +1382,13 @@ struct ieee80211_rx_status {
u8 zero_length_psdu_type; u8 zero_length_psdu_type;
}; };
static inline u32
ieee80211_rx_status_to_khz(struct ieee80211_rx_status *rx_status)
{
return MHZ_TO_KHZ(rx_status->freq) +
(rx_status->freq_offset ? 500 : 0);
}
/** /**
* struct ieee80211_vendor_radiotap - vendor radiotap data information * struct ieee80211_vendor_radiotap - vendor radiotap data information
* @present: presence bitmap for this vendor namespace * @present: presence bitmap for this vendor namespace
......
...@@ -3683,7 +3683,8 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, ...@@ -3683,7 +3683,8 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
sdata_assert_lock(sdata); sdata_assert_lock(sdata);
channel = ieee80211_get_channel(local->hw.wiphy, rx_status->freq); channel = ieee80211_get_channel_khz(local->hw.wiphy,
ieee80211_rx_status_to_khz(rx_status));
if (!channel) if (!channel)
return; return;
...@@ -3899,7 +3900,8 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, ...@@ -3899,7 +3900,8 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
return; return;
} }
if (rx_status->freq != chanctx_conf->def.chan->center_freq) { if (ieee80211_rx_status_to_khz(rx_status) !=
ieee80211_channel_to_khz(chanctx_conf->def.chan)) {
rcu_read_unlock(); rcu_read_unlock();
return; return;
} }
......
...@@ -412,6 +412,7 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local, ...@@ -412,6 +412,7 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local,
pos++; pos++;
/* IEEE80211_RADIOTAP_CHANNEL */ /* IEEE80211_RADIOTAP_CHANNEL */
/* TODO: frequency offset in KHz */
put_unaligned_le16(status->freq, pos); put_unaligned_le16(status->freq, pos);
pos += 2; pos += 2;
if (status->bw == RATE_INFO_BW_10) if (status->bw == RATE_INFO_BW_10)
......
...@@ -275,7 +275,8 @@ void ieee80211_scan_rx(struct ieee80211_local *local, struct sk_buff *skb) ...@@ -275,7 +275,8 @@ void ieee80211_scan_rx(struct ieee80211_local *local, struct sk_buff *skb)
return; return;
} }
channel = ieee80211_get_channel(local->hw.wiphy, rx_status->freq); channel = ieee80211_get_channel_khz(local->hw.wiphy,
ieee80211_rx_status_to_khz(rx_status));
if (!channel || channel->flags & IEEE80211_CHAN_DISABLED) if (!channel || channel->flags & IEEE80211_CHAN_DISABLED)
return; return;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册