Skip to content
/ linux Public

Commit 27bcd60

Browse files
KeylostSasha Levin
authored andcommitted
wifi: rtw88: fix DTIM period handling when conf->dtim_period is zero
[ Upstream commit 9f68fdc ] The function rtw_set_dtim_period() accepted an 'int' dtim_period parameter, while mac80211 provides dtim_period as 'u8' in struct ieee80211_bss_conf. In IBSS (ad-hoc) mode mac80211 may set dtim_period to 0. The driver unconditionally wrote (dtim_period - 1) to REG_DTIM_COUNTER_ROOT, which resulted in 0xFF when dtim_period was 0. This caused delays in broadcast/multicast traffic processing and issues with ad-hoc operation. Convert the function parameter to u8 to match ieee80211_bss_conf and avoid the underflow by writing 0 when dtim_period is 0. Link: lwfinger/rtw88#406 Signed-off-by: Roman Peshkichev <roman.peshkichev@gmail.com> Acked-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Link: https://patch.msgid.link/20251125180937.22977-1-roman.peshkichev@gmail.com Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent a3d6608 commit 27bcd60

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

drivers/net/wireless/realtek/rtw88/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -684,10 +684,10 @@ void rtw_set_rx_freq_band(struct rtw_rx_pkt_stat *pkt_stat, u8 channel)
684684
}
685685
EXPORT_SYMBOL(rtw_set_rx_freq_band);
686686

687-
void rtw_set_dtim_period(struct rtw_dev *rtwdev, int dtim_period)
687+
void rtw_set_dtim_period(struct rtw_dev *rtwdev, u8 dtim_period)
688688
{
689689
rtw_write32_set(rtwdev, REG_TCR, BIT_TCR_UPDATE_TIMIE);
690-
rtw_write8(rtwdev, REG_DTIM_COUNTER_ROOT, dtim_period - 1);
690+
rtw_write8(rtwdev, REG_DTIM_COUNTER_ROOT, dtim_period ? dtim_period - 1 : 0);
691691
}
692692

693693
void rtw_update_channel(struct rtw_dev *rtwdev, u8 center_channel,

drivers/net/wireless/realtek/rtw88/main.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2150,7 +2150,7 @@ enum nl80211_band rtw_hw_to_nl80211_band(enum rtw_supported_band hw_band)
21502150
}
21512151

21522152
void rtw_set_rx_freq_band(struct rtw_rx_pkt_stat *pkt_stat, u8 channel);
2153-
void rtw_set_dtim_period(struct rtw_dev *rtwdev, int dtim_period);
2153+
void rtw_set_dtim_period(struct rtw_dev *rtwdev, u8 dtim_period);
21542154
void rtw_get_channel_params(struct cfg80211_chan_def *chandef,
21552155
struct rtw_channel_params *ch_param);
21562156
bool check_hw_ready(struct rtw_dev *rtwdev, u32 addr, u32 mask, u32 target);

0 commit comments

Comments
 (0)