wifi: mac80211: move ps setting to vif config
authorJohannes Berg <johannes.berg@intel.com>
Fri, 24 Jun 2022 13:02:16 +0000 (15:02 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 15 Jul 2022 09:43:15 +0000 (11:43 +0200)
This really shouldn't be in a per-link config, we don't want
to let anyone control it that way (if anything, link powersave
could be forced through APIs to activate/deactivate a link),
and we don't support powersave in software with devices that
can do MLO.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
13 files changed:
drivers/net/wireless/ath/ath10k/mac.c
drivers/net/wireless/ath/ath11k/mac.c
drivers/net/wireless/ath/wcn36xx/main.c
drivers/net/wireless/intel/iwlwifi/mvm/power.c
drivers/net/wireless/intel/iwlwifi/mvm/rs.c
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
drivers/net/wireless/mediatek/mt76/mt7921/mcu.c
drivers/net/wireless/silabs/wfx/sta.c
drivers/net/wireless/ti/wlcore/main.c
include/net/mac80211.h
net/mac80211/main.c
net/mac80211/mlme.c
net/mac80211/trace.h

index 3d111d6447f006eb06be5d552454acc5a9487685..b18f32261d15914b797af133cbeb310be814ad51 100644 (file)
@@ -6252,7 +6252,7 @@ static void ath10k_bss_info_changed(struct ieee80211_hw *hw,
        }
 
        if (changed & BSS_CHANGED_PS) {
-               arvif->ps = vif->bss_conf.ps;
+               arvif->ps = vif->cfg.ps;
 
                ret = ath10k_config_ps(ar);
                if (ret)
index 17dbc7d9cf29a2e5d2caf1fc98e17c2e882ece66..1cf1e1f18dba0b22b75b64c956ad2ce91549e465 100644 (file)
@@ -3292,7 +3292,7 @@ static void ath11k_mac_op_bss_info_changed(struct ieee80211_hw *hw,
 
        if (changed & BSS_CHANGED_PS &&
            ar->ab->hw_params.supports_sta_ps) {
-               arvif->ps = vif->bss_conf.ps;
+               arvif->ps = vif->cfg.ps;
 
                ret = ath11k_mac_config_ps(ar);
                if (ret)
index ace8641909bd076dc8f443dab68b90ff4030c162..dc59cafd29e38fdf0ac2089f4239abbf82197445 100644 (file)
@@ -385,7 +385,7 @@ static void wcn36xx_change_ps(struct wcn36xx *wcn, bool enable)
        list_for_each_entry(tmp, &wcn->vif_list, list) {
                vif = wcn36xx_priv_to_vif(tmp);
                if (enable && !wcn->sw_scan) {
-                       if (vif->bss_conf.ps) /* ps allowed ? */
+                       if (vif->cfg.ps) /* ps allowed ? */
                                wcn36xx_pmc_enter_bmps_state(wcn, vif);
                } else {
                        wcn36xx_pmc_exit_bmps_state(wcn, vif);
index b49f265a421f291da62353162778e7b389456d91..f5744162d0d84530ac2f6102680c091f89fffb66 100644 (file)
@@ -359,7 +359,7 @@ static void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm,
 
        cmd->flags |= cpu_to_le16(POWER_FLAGS_POWER_SAVE_ENA_MSK);
 
-       if (!vif->bss_conf.ps || !mvmvif->pm_enabled)
+       if (!vif->cfg.ps || !mvmvif->pm_enabled)
                return;
 
        if (iwl_mvm_vif_low_latency(mvmvif) && vif->p2p &&
@@ -890,7 +890,7 @@ static int iwl_mvm_power_set_ba(struct iwl_mvm *mvm,
 
        mvmvif->bf_data.ba_enabled = !(!mvmvif->pm_enabled ||
                                       mvm->ps_disabled ||
-                                      !vif->bss_conf.ps ||
+                                      !vif->cfg.ps ||
                                       iwl_mvm_vif_low_latency(mvmvif));
 
        return _iwl_mvm_enable_beacon_filter(mvm, vif, &cmd, 0);
index 303975f9e2b58c2f32214e02ce6af1d050fa7e63..a79043f307751a1afa2e551153e9ef5254b6e393 100644 (file)
@@ -1861,7 +1861,7 @@ static bool rs_tpc_allowed(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
        int index = rate->index;
        bool cam = (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_CAM);
        bool sta_ps_disabled = (vif->type == NL80211_IFTYPE_STATION &&
-                               !vif->bss_conf.ps);
+                               !vif->cfg.ps);
 
        IWL_DEBUG_RATE(mvm, "cam: %d sta_ps_disabled %d\n",
                       cam, sta_ps_disabled);
index d3da54e6670b2e682c5941e54c5b561b94d06458..389f8c61939d0a1ef285c59b0838b885144d6693 100644 (file)
@@ -193,7 +193,7 @@ int mt76_connac_mcu_set_vif_ps(struct mt76_dev *dev, struct ieee80211_vif *vif)
                              */
        } req = {
                .bss_idx = mvif->idx,
-               .ps_state = vif->bss_conf.ps ? 2 : 0,
+               .ps_state = vif->cfg.ps ? 2 : 0,
        };
 
        if (vif->type != NL80211_IFTYPE_STATION)
index 3b5b475b0875ca1bb7baafa2c2f9c954a913cb64..976686075dd7105d835675a01e02665f6a361672 100644 (file)
@@ -972,7 +972,7 @@ int mt7921_mcu_uni_bss_ps(struct mt7921_dev *dev, struct ieee80211_vif *vif)
                .ps = {
                        .tag = cpu_to_le16(UNI_BSS_INFO_PS),
                        .len = cpu_to_le16(sizeof(struct ps_tlv)),
-                       .ps_state = vif->bss_conf.ps ? 2 : 0,
+                       .ps_state = vif->cfg.ps ? 2 : 0,
                },
        };
 
index 0378144795ca66eb59fbb2a6f1e95b9dfd32e2ca..47fd887ce6fec76d4c69134826d8f0a38dcda789 100644 (file)
@@ -175,7 +175,7 @@ static int wfx_get_ps_timeout(struct wfx_vif *wvif, bool *enable_ps)
                        /* It is useless to enable PS if channels are the same. */
                        if (enable_ps)
                                *enable_ps = false;
-                       if (vif->cfg.assoc && vif->bss_conf.ps)
+                       if (vif->cfg.assoc && vif->cfg.ps)
                                dev_info(wvif->wdev->dev, "ignoring requested PS mode");
                        return -1;
                }
@@ -188,8 +188,8 @@ static int wfx_get_ps_timeout(struct wfx_vif *wvif, bool *enable_ps)
                        return 30;
        }
        if (enable_ps)
-               *enable_ps = vif->bss_conf.ps;
-       if (vif->cfg.assoc && vif->bss_conf.ps)
+               *enable_ps = vif->cfg.ps;
+       if (vif->cfg.assoc && vif->cfg.ps)
                return conf->dynamic_ps_timeout;
        else
                return -1;
index a1923ef52d5576868c38314cd10a43a722e249be..d1200080f165e5e99edf984b32f3bc1a7aa0e2f8 100644 (file)
@@ -4481,7 +4481,7 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl,
        }
 
        if (changed & BSS_CHANGED_PS) {
-               if ((bss_conf->ps) &&
+               if (vif->cfg.ps &&
                    test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags) &&
                    !test_bit(WLVIF_FLAG_IN_PS, &wlvif->flags)) {
                        int ps_mode;
@@ -4501,7 +4501,7 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl,
                        if (ret < 0)
                                wl1271_warning("enter %s ps failed %d",
                                               ps_mode_str, ret);
-               } else if (!bss_conf->ps &&
+               } else if (!vif->cfg.ps &&
                           test_bit(WLVIF_FLAG_IN_PS, &wlvif->flags)) {
                        wl1271_debug(DEBUG_PSM, "auto ps disabled");
 
index 877b3eca6db4485be0b18cfe5c1e709677325bfc..fba06d7bc7ebe9bec0dced66ca3dd8ee0e4908b9 100644 (file)
@@ -578,8 +578,6 @@ struct ieee80211_fils_discovery {
  * @cqm_rssi_high: Connection quality monitor RSSI upper threshold.
  * @cqm_rssi_hyst: Connection quality monitor RSSI hysteresis
  * @qos: This is a QoS-enabled BSS.
- * @ps: power-save mode (STA only). This flag is NOT affected by
- *     offchannel/dynamic_ps operations.
  * @hidden_ssid: The SSID of the current vif is hidden. Only valid in AP-mode.
  * @txpower: TX power in dBm.  INT_MIN means not configured.
  * @txpower_type: TX power adjustment used to control per packet Transmit
@@ -673,7 +671,6 @@ struct ieee80211_bss_conf {
        struct cfg80211_chan_def chandef;
        struct ieee80211_mu_group_data mu_group;
        bool qos;
-       bool ps;
        bool hidden_ssid;
        int txpower;
        enum nl80211_tx_power_setting txpower_type;
@@ -1715,6 +1712,8 @@ enum ieee80211_offload_flags {
  * @assoc: association status
  * @ibss_joined: indicates whether this station is part of an IBSS or not
  * @ibss_creator: indicates if a new IBSS network is being created
+ * @ps: power-save mode (STA only). This flag is NOT affected by
+ *     offchannel/dynamic_ps operations.
  * @aid: association ID number, valid only when @assoc is true
  * @arp_addr_list: List of IPv4 addresses for hardware ARP filtering. The
  *     may filter ARP queries targeted for other addresses than listed here.
@@ -1734,6 +1733,7 @@ struct ieee80211_vif_cfg {
        /* association related data */
        bool assoc, ibss_joined;
        bool ibss_creator;
+       bool ps;
        u16 aid;
 
        __be32 arp_addr_list[IEEE80211_BSS_ARP_ADDR_LIST_LEN];
index 191f4d35ef60156eee44fcfd2b727538bd3afb08..1258e506377ecb1bb0dc5f007d214998148089c5 100644 (file)
@@ -202,6 +202,7 @@ int ieee80211_hw_config(struct ieee80211_local *local, u32 changed)
 
 #define BSS_CHANGED_VIF_CFG_FLAGS (BSS_CHANGED_ASSOC |\
                                   BSS_CHANGED_IDLE |\
+                                  BSS_CHANGED_PS |\
                                   BSS_CHANGED_IBSS |\
                                   BSS_CHANGED_ARP_FILTER |\
                                   BSS_CHANGED_SSID)
index 299381d197606c42c93c34be3ff20b463db2bff0..f8be05804e5977cceecbeea5ffb238e91118a3bf 100644 (file)
@@ -1869,10 +1869,9 @@ void ieee80211_recalc_ps_vif(struct ieee80211_sub_if_data *sdata)
 {
        bool ps_allowed = ieee80211_powersave_allowed(sdata);
 
-       if (sdata->vif.bss_conf.ps != ps_allowed) {
-               sdata->vif.bss_conf.ps = ps_allowed;
-               ieee80211_link_info_change_notify(sdata, &sdata->deflink,
-                                                 BSS_CHANGED_PS);
+       if (sdata->vif.cfg.ps != ps_allowed) {
+               sdata->vif.cfg.ps = ps_allowed;
+               ieee80211_vif_cfg_change_notify(sdata, BSS_CHANGED_PS);
        }
 }
 
index 6aa06fba5b50ebab86a146b6e9ab8adb701549f8..751f08b47d0c0bf1dda145d7acb32ed7b7ccbc58 100644 (file)
@@ -413,6 +413,7 @@ TRACE_EVENT(drv_vif_cfg_changed,
                __dynamic_array(u8, ssid, sdata->vif.cfg.ssid_len)
                __field(int, s1g)
                __field(bool, idle)
+               __field(bool, ps)
        ),
 
        TP_fast_assign(
@@ -423,6 +424,7 @@ TRACE_EVENT(drv_vif_cfg_changed,
                __entry->assoc = sdata->vif.cfg.assoc;
                __entry->ibss_joined = sdata->vif.cfg.ibss_joined;
                __entry->ibss_creator = sdata->vif.cfg.ibss_creator;
+               __entry->ps = sdata->vif.cfg.ps;
 
                __entry->arp_addr_cnt = sdata->vif.cfg.arp_addr_cnt;
                memcpy(__get_dynamic_array(arp_addr_list),
@@ -475,7 +477,6 @@ TRACE_EVENT(drv_link_info_changed,
                __field(u32, channel_cfreq1)
                __field(u32, channel_cfreq1_offset)
                __field(bool, qos)
-               __field(bool, ps)
                __field(bool, hidden_ssid)
                __field(int, txpower)
                __field(u8, p2p_oppps_ctwindow)
@@ -506,7 +507,6 @@ TRACE_EVENT(drv_link_info_changed,
                __entry->channel_cfreq1 = link_conf->chandef.center_freq1;
                __entry->channel_cfreq1_offset = link_conf->chandef.freq1_offset;
                __entry->qos = link_conf->qos;
-               __entry->ps = link_conf->ps;
                __entry->hidden_ssid = link_conf->hidden_ssid;
                __entry->txpower = link_conf->txpower;
                __entry->p2p_oppps_ctwindow = link_conf->p2p_noa_attr.oppps_ctwindow;