Commit 11ca0163 authored by Shayne Chen's avatar Shayne Chen Committed by Felix Fietkau
Browse files

wifi: mt76: mt7996: only set vif teardown cmds at remove interface



Only send commands that disable vif when removing interface, this
reduces some unnecessary bss_info and sta_rec commands, especially for
station interface.

Signed-off-by: default avatarShayne Chen <shayne.chen@mediatek.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 84f313b7
Loading
Loading
Loading
Loading
+6 −15
Original line number Diff line number Diff line
@@ -248,8 +248,8 @@ static void mt7996_remove_interface(struct ieee80211_hw *hw,
	struct mt7996_phy *phy = mt7996_hw_phy(hw);
	int idx = msta->wcid.idx;

	mt7996_mcu_add_bss_info(phy, vif, false);
	mt7996_mcu_add_sta(dev, vif, NULL, false);
	mt7996_mcu_add_bss_info(phy, vif, false);

	if (vif == phy->monitor_vif)
		phy->monitor_vif = NULL;
@@ -570,17 +570,13 @@ static void mt7996_bss_info_changed(struct ieee80211_hw *hw,
	/* station mode uses BSSID to map the wlan entry to a peer,
	 * and then peer references bss_info_rfch to set bandwidth cap.
	 */
	if (changed & BSS_CHANGED_BSSID &&
	    vif->type == NL80211_IFTYPE_STATION) {
		bool join = !is_zero_ether_addr(info->bssid);

		mt7996_mcu_add_bss_info(phy, vif, join);
		mt7996_mcu_add_sta(dev, vif, NULL, join);
	if ((changed & BSS_CHANGED_BSSID && !is_zero_ether_addr(info->bssid)) ||
	    (changed & BSS_CHANGED_ASSOC && vif->cfg.assoc) ||
	    (changed & BSS_CHANGED_BEACON_ENABLED && info->enable_beacon)) {
		mt7996_mcu_add_bss_info(phy, vif, true);
		mt7996_mcu_add_sta(dev, vif, NULL, true);
	}

	if (changed & BSS_CHANGED_ASSOC)
		mt7996_mcu_add_bss_info(phy, vif, vif->cfg.assoc);

	if (changed & BSS_CHANGED_ERP_CTS_PROT)
		mt7996_mac_enable_rtscts(dev, vif, info->use_cts_prot);

@@ -601,11 +597,6 @@ static void mt7996_bss_info_changed(struct ieee80211_hw *hw,
		mvif->basic_rates_idx =
			mt7996_get_rates_table(hw, vif, false, false);

	if (changed & BSS_CHANGED_BEACON_ENABLED && info->enable_beacon) {
		mt7996_mcu_add_bss_info(phy, vif, true);
		mt7996_mcu_add_sta(dev, vif, NULL, true);
	}

	/* ensure that enable txcmd_mode after bss_info */
	if (changed & (BSS_CHANGED_QOS | BSS_CHANGED_BEACON_ENABLED))
		mt7996_mcu_set_tx(dev, vif);