wifi: rtw89: correct 5 MHz mask setting

[ Upstream commit d33fc8d036 ]

Use primary channel index to determine which 5 MHz mask should be enable.
This mask is used to prevent noise from channel edge to effect CCA
threshold in wide bandwidth (>= 40 MHZ).

Fixes: 1b00e9236a ("rtw89: 8852c: add set channel of BB part")
Fixes: 6b0698984e ("wifi: rtw89: 8852b: add chip_ops::set_channel")
Cc: stable@vger.kernel.org
Signed-off-by: Eric Huang <echuang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230406072841.8308-1-pkshih@realtek.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Eric Huang
2023-04-06 15:28:41 +08:00
committed by Greg Kroah-Hartman
parent 07c8c1a3cf
commit b5ceb6aac6

View File

@@ -1484,18 +1484,19 @@ static void rtw8852c_5m_mask(struct rtw89_dev *rtwdev,
const struct rtw89_chan *chan, const struct rtw89_chan *chan,
enum rtw89_phy_idx phy_idx) enum rtw89_phy_idx phy_idx)
{ {
u8 pri_ch = chan->primary_channel; u8 pri_ch = chan->pri_ch_idx;
bool mask_5m_low; bool mask_5m_low;
bool mask_5m_en; bool mask_5m_en;
switch (chan->band_width) { switch (chan->band_width) {
case RTW89_CHANNEL_WIDTH_40: case RTW89_CHANNEL_WIDTH_40:
mask_5m_en = true; mask_5m_en = true;
mask_5m_low = pri_ch == 2; mask_5m_low = pri_ch == RTW89_SC_20_LOWER;
break; break;
case RTW89_CHANNEL_WIDTH_80: case RTW89_CHANNEL_WIDTH_80:
mask_5m_en = ((pri_ch == 3) || (pri_ch == 4)); mask_5m_en = pri_ch == RTW89_SC_20_UPMOST ||
mask_5m_low = pri_ch == 4; pri_ch == RTW89_SC_20_LOWEST;
mask_5m_low = pri_ch == RTW89_SC_20_LOWEST;
break; break;
default: default:
mask_5m_en = false; mask_5m_en = false;