Commit aac86ceb authored by Felix Fietkau's avatar Felix Fietkau
Browse files

mt76: mt7615: fix throughput regression on DFS channels



For some reason, mt7615 reacts badly to repeatedly enabling/disabling the radar
detector without also switching the channel.
This results in very bad throughput on DFS channels, because
hw->conf.radar_enabled can get toggled a few times after CAC ends.
Fix this by always leaving the DFS detector enabled on DFS channels and instead
suppress unwanted detection events.

Fixes: 2c86f675 ("mt76: mt7615: fix/rewrite the dfs state handling logic")
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 3c1032e1
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -2231,6 +2231,7 @@ mt7615_dfs_init_radar_specs(struct mt7615_phy *phy)

int mt7615_dfs_init_radar_detector(struct mt7615_phy *phy)
{
	struct cfg80211_chan_def *chandef = &phy->mt76->chandef;
	struct mt7615_dev *dev = phy->dev;
	bool ext_phy = phy != &dev->phy;
	enum mt76_dfs_state dfs_state, prev_state;
@@ -2241,13 +2242,13 @@ int mt7615_dfs_init_radar_detector(struct mt7615_phy *phy)

	prev_state = phy->mt76->dfs_state;
	dfs_state = mt76_phy_dfs_state(phy->mt76);
	if ((chandef->chan->flags & IEEE80211_CHAN_RADAR) &&
	    dfs_state < MT_DFS_STATE_CAC)
		dfs_state = MT_DFS_STATE_ACTIVE;

	if (prev_state == dfs_state)
		return 0;

	if (prev_state == MT_DFS_STATE_UNKNOWN)
		mt7615_dfs_stop_radar_detector(phy);

	if (dfs_state == MT_DFS_STATE_DISABLED)
		goto stop;

+0 −21
Original line number Diff line number Diff line
@@ -282,26 +282,6 @@ static void mt7615_remove_interface(struct ieee80211_hw *hw,
	mt76_packet_id_flush(&dev->mt76, &mvif->sta.wcid);
}

static void mt7615_init_dfs_state(struct mt7615_phy *phy)
{
	struct mt76_phy *mphy = phy->mt76;
	struct ieee80211_hw *hw = mphy->hw;
	struct cfg80211_chan_def *chandef = &hw->conf.chandef;

	if (hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)
		return;

	if (!(chandef->chan->flags & IEEE80211_CHAN_RADAR) &&
	    !(mphy->chandef.chan->flags & IEEE80211_CHAN_RADAR))
		return;

	if (mphy->chandef.chan->center_freq == chandef->chan->center_freq &&
	    mphy->chandef.width == chandef->width)
		return;

	phy->dfs_state = -1;
}

int mt7615_set_channel(struct mt7615_phy *phy)
{
	struct mt7615_dev *dev = phy->dev;
@@ -314,7 +294,6 @@ int mt7615_set_channel(struct mt7615_phy *phy)

	set_bit(MT76_RESET, &phy->mt76->state);

	mt7615_init_dfs_state(phy);
	mt76_set_channel(phy->mt76);

	if (is_mt7615(&dev->mt76) && dev->flash_eeprom) {
+3 −0
Original line number Diff line number Diff line
@@ -391,6 +391,9 @@ mt7615_mcu_rx_radar_detected(struct mt7615_dev *dev, struct sk_buff *skb)
	if (r->band_idx && dev->mt76.phy2)
		mphy = dev->mt76.phy2;

	if (mt76_phy_dfs_state(mphy) < MT_DFS_STATE_CAC)
		return;

	ieee80211_radar_detected(mphy->hw);
	dev->hw_pattern++;
}
+0 −1
Original line number Diff line number Diff line
@@ -178,7 +178,6 @@ struct mt7615_phy {

	u8 chfreq;
	u8 rdd_state;
	int dfs_state;

	u32 rx_ampdu_ts;
	u32 ampdu_ref;