Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mt76: mt7615: do not always reset the dfs state setting the channel

mac80211/hostapd runs mt7615_set_channel with the same channel
parameters sending multiple rdd commands overwriting the previous ones.
This behaviour is causing tpt issues on dfs channels.
Fix the issue checking new channel freq/width with the running one.

Fixes: 5dabdf71e94e ("mt76: mt7615: add multiple wiphy support to the dfs support code")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>

authored by

Lorenzo Bianconi and committed by
Felix Fietkau
fdb786cc 044883e3

+20 -1
+20 -1
drivers/net/wireless/mediatek/mt76/mt7615/main.c
··· 220 220 spin_unlock_bh(&dev->sta_poll_lock); 221 221 } 222 222 223 + static void mt7615_init_dfs_state(struct mt7615_phy *phy) 224 + { 225 + struct mt76_phy *mphy = phy->mt76; 226 + struct ieee80211_hw *hw = mphy->hw; 227 + struct cfg80211_chan_def *chandef = &hw->conf.chandef; 228 + 229 + if (hw->conf.flags & IEEE80211_CONF_OFFCHANNEL) 230 + return; 231 + 232 + if (!(chandef->chan->flags & IEEE80211_CHAN_RADAR)) 233 + return; 234 + 235 + if (mphy->chandef.chan->center_freq == chandef->chan->center_freq && 236 + mphy->chandef.width == chandef->width) 237 + return; 238 + 239 + phy->dfs_state = -1; 240 + } 241 + 223 242 static int mt7615_set_channel(struct mt7615_phy *phy) 224 243 { 225 244 struct mt7615_dev *dev = phy->dev; ··· 250 231 mutex_lock(&dev->mt76.mutex); 251 232 set_bit(MT76_RESET, &phy->mt76->state); 252 233 253 - phy->dfs_state = -1; 234 + mt7615_init_dfs_state(phy); 254 235 mt76_set_channel(phy->mt76); 255 236 256 237 ret = mt7615_mcu_set_chan_info(phy, MCU_EXT_CMD_CHANNEL_SWITCH);