Add a per-vif dev_active flag and a wrapper around mt76_connac_mcu_uni_add_dev() that skips a redundant DEV (de)activation command and keeps the flag in sync with the firmware DEV state. This is a preparation patch before the MT7925 MLO DEV (de)activation work. Signed-off-by: Emery Hsin --- drivers/net/wireless/mediatek/mt76/mt792x.h | 5 +++++ .../net/wireless/mediatek/mt76/mt792x_core.c | 20 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt792x.h b/drivers/net/wireless/mediatek/mt76/mt792x.h index 8a366356e560..b9bcc5e1197c 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x.h +++ b/drivers/net/wireless/mediatek/mt76/mt792x.h @@ -181,6 +181,7 @@ struct mt792x_bss_conf { struct ewma_rssi rssi; struct ieee80211_tx_queue_params queue_params[IEEE80211_NUM_ACS]; unsigned int link_id; + bool dev_active; bool absent; @@ -586,6 +587,10 @@ int mt792x_mcu_fw_pmctrl(struct mt792x_dev *dev); void mt792x_mac_link_bss_remove(struct mt792x_dev *dev, struct mt792x_bss_conf *mconf, struct mt792x_link_sta *mlink); +int mt792x_mcu_set_dev_active(struct mt792x_dev *dev, + struct ieee80211_bss_conf *link_conf, + struct mt792x_bss_conf *mconf, + struct mt76_wcid *wcid, bool enable); void mt792x_config_mac_addr_list(struct mt792x_dev *dev); static inline char *mt792x_ram_name(struct mt792x_dev *dev) diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_core.c b/drivers/net/wireless/mediatek/mt76/mt792x_core.c index 1965e9de7099..420aba8519e2 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x_core.c +++ b/drivers/net/wireless/mediatek/mt76/mt792x_core.c @@ -302,6 +302,26 @@ void mt792x_mac_link_bss_remove(struct mt792x_dev *dev, } EXPORT_SYMBOL_GPL(mt792x_mac_link_bss_remove); +int mt792x_mcu_set_dev_active(struct mt792x_dev *dev, + struct ieee80211_bss_conf *link_conf, + struct mt792x_bss_conf *mconf, + struct mt76_wcid *wcid, bool enable) +{ + int ret; + + /* skip a redundant command when already in the requested state */ + if (mconf->dev_active == enable) + return 0; + + ret = mt76_connac_mcu_uni_add_dev(&dev->mphy, link_conf, + &mconf->mt76, wcid, enable); + if (!ret) + mconf->dev_active = enable; + + return ret; +} +EXPORT_SYMBOL_GPL(mt792x_mcu_set_dev_active); + void mt792x_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { -- 2.45.2