mirror of
https://github.com/torvalds/linux.git
synced 2026-06-03 12:03:54 +02:00
wifi: rtw89: Parse channel from IE to correct invalid hardware reports during scanning
For some packets, we could not get channel information from PPDU status. And this causes wrong frequencies being reported. Parse the channel information from IE if provided by AP to fix this. Signed-off-by: Chih-Kang Chang <gary.chang@realtek.com> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Link: https://patch.msgid.link/20250220064357.17962-1-pkshih@realtek.com
This commit is contained in:
parent
9e9877bd82
commit
e16acf907a
|
|
@ -2382,6 +2382,49 @@ static void rtw89_core_validate_rx_signal(struct ieee80211_rx_status *rx_status)
|
|||
rx_status->flag |= RX_FLAG_NO_SIGNAL_VAL;
|
||||
}
|
||||
|
||||
static void rtw89_core_update_rx_freq_from_ie(struct rtw89_dev *rtwdev,
|
||||
struct sk_buff *skb,
|
||||
struct ieee80211_rx_status *rx_status)
|
||||
{
|
||||
struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data;
|
||||
size_t hdr_len, ielen;
|
||||
u8 *variable;
|
||||
int chan;
|
||||
|
||||
if (!rtwdev->chip->rx_freq_frome_ie)
|
||||
return;
|
||||
|
||||
if (!rtwdev->scanning)
|
||||
return;
|
||||
|
||||
if (ieee80211_is_beacon(mgmt->frame_control)) {
|
||||
variable = mgmt->u.beacon.variable;
|
||||
hdr_len = offsetof(struct ieee80211_mgmt,
|
||||
u.beacon.variable);
|
||||
} else if (ieee80211_is_probe_resp(mgmt->frame_control)) {
|
||||
variable = mgmt->u.probe_resp.variable;
|
||||
hdr_len = offsetof(struct ieee80211_mgmt,
|
||||
u.probe_resp.variable);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
if (skb->len > hdr_len)
|
||||
ielen = skb->len - hdr_len;
|
||||
else
|
||||
return;
|
||||
|
||||
/* The parsing code for both 2GHz and 5GHz bands is the same in this
|
||||
* function.
|
||||
*/
|
||||
chan = cfg80211_get_ies_channel_number(variable, ielen, NL80211_BAND_2GHZ);
|
||||
if (chan == -1)
|
||||
return;
|
||||
|
||||
rx_status->band = chan > 14 ? RTW89_BAND_5G : RTW89_BAND_2G;
|
||||
rx_status->freq = ieee80211_channel_to_frequency(chan, rx_status->band);
|
||||
}
|
||||
|
||||
static void rtw89_core_rx_to_mac80211(struct rtw89_dev *rtwdev,
|
||||
struct rtw89_rx_phy_ppdu *phy_ppdu,
|
||||
struct rtw89_rx_desc_info *desc_info,
|
||||
|
|
@ -2399,6 +2442,7 @@ static void rtw89_core_rx_to_mac80211(struct rtw89_dev *rtwdev,
|
|||
rtw89_core_update_rx_status_by_ppdu(rtwdev, rx_status, phy_ppdu);
|
||||
rtw89_core_update_radiotap(rtwdev, skb_ppdu, rx_status);
|
||||
rtw89_core_validate_rx_signal(rx_status);
|
||||
rtw89_core_update_rx_freq_from_ie(rtwdev, skb_ppdu, rx_status);
|
||||
|
||||
/* In low power mode, it does RX in thread context. */
|
||||
local_bh_disable();
|
||||
|
|
|
|||
|
|
@ -4283,6 +4283,7 @@ struct rtw89_chip_info {
|
|||
bool support_ant_gain;
|
||||
bool ul_tb_waveform_ctrl;
|
||||
bool ul_tb_pwr_diff;
|
||||
bool rx_freq_frome_ie;
|
||||
bool hw_sec_hdr;
|
||||
bool hw_mgmt_tx_encrypt;
|
||||
bool hw_tkip_crypto;
|
||||
|
|
|
|||
|
|
@ -2500,6 +2500,7 @@ const struct rtw89_chip_info rtw8851b_chip_info = {
|
|||
.support_ant_gain = false,
|
||||
.ul_tb_waveform_ctrl = true,
|
||||
.ul_tb_pwr_diff = false,
|
||||
.rx_freq_frome_ie = true,
|
||||
.hw_sec_hdr = false,
|
||||
.hw_mgmt_tx_encrypt = false,
|
||||
.hw_tkip_crypto = false,
|
||||
|
|
|
|||
|
|
@ -2218,6 +2218,7 @@ const struct rtw89_chip_info rtw8852a_chip_info = {
|
|||
.support_ant_gain = false,
|
||||
.ul_tb_waveform_ctrl = false,
|
||||
.ul_tb_pwr_diff = false,
|
||||
.rx_freq_frome_ie = true,
|
||||
.hw_sec_hdr = false,
|
||||
.hw_mgmt_tx_encrypt = false,
|
||||
.hw_tkip_crypto = false,
|
||||
|
|
|
|||
|
|
@ -854,6 +854,7 @@ const struct rtw89_chip_info rtw8852b_chip_info = {
|
|||
.support_ant_gain = true,
|
||||
.ul_tb_waveform_ctrl = true,
|
||||
.ul_tb_pwr_diff = false,
|
||||
.rx_freq_frome_ie = true,
|
||||
.hw_sec_hdr = false,
|
||||
.hw_mgmt_tx_encrypt = false,
|
||||
.hw_tkip_crypto = false,
|
||||
|
|
|
|||
|
|
@ -787,6 +787,7 @@ const struct rtw89_chip_info rtw8852bt_chip_info = {
|
|||
.support_ant_gain = true,
|
||||
.ul_tb_waveform_ctrl = true,
|
||||
.ul_tb_pwr_diff = false,
|
||||
.rx_freq_frome_ie = true,
|
||||
.hw_sec_hdr = false,
|
||||
.hw_mgmt_tx_encrypt = false,
|
||||
.hw_tkip_crypto = true,
|
||||
|
|
|
|||
|
|
@ -3013,6 +3013,7 @@ const struct rtw89_chip_info rtw8852c_chip_info = {
|
|||
.support_ant_gain = true,
|
||||
.ul_tb_waveform_ctrl = false,
|
||||
.ul_tb_pwr_diff = true,
|
||||
.rx_freq_frome_ie = false,
|
||||
.hw_sec_hdr = true,
|
||||
.hw_mgmt_tx_encrypt = true,
|
||||
.hw_tkip_crypto = true,
|
||||
|
|
|
|||
|
|
@ -2772,6 +2772,7 @@ const struct rtw89_chip_info rtw8922a_chip_info = {
|
|||
.support_ant_gain = false,
|
||||
.ul_tb_waveform_ctrl = false,
|
||||
.ul_tb_pwr_diff = false,
|
||||
.rx_freq_frome_ie = false,
|
||||
.hw_sec_hdr = true,
|
||||
.hw_mgmt_tx_encrypt = true,
|
||||
.hw_tkip_crypto = true,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user