]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
wifi: iwlwifi: mvm: improve/fix chanctx min_def use logic
authorJohannes Berg <johannes.berg@intel.com>
Tue, 31 Dec 2024 11:59:05 +0000 (13:59 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 13 Jan 2025 14:34:06 +0000 (15:34 +0100)
There are two cases in which the min_def isn't used:
 a) if FILS will be enabled
 b) if FTM responder is enabled

Both of these apply to AP mode only, but for FILS we're
not checking that right now. Change the code to iterate
the interfaces and links using the channel context, and
check for AP mode for both, not just for FTM responder.

In the case of iwl_mvm_enable_fils() this might also fix
an issue where FILS is enabled for an IBSS network that
happens to be started on 6 GHz, though that's not very
likely to be possible due to regulatory.

However for RX OMI bandwidth reduction the driver needs
to use the min_def in client mode as well, in order to
actually reduce bandwidth when it requested that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20241231135726.7b91025e103d.I4c99c03fd32363d574ab5e34798b6099401f0729@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h

index daa3bfaccaba4c3f7cf5994fbc7d2f0f4d84fd3f..6b06732441c357a2f3823aebcbeb57a483f0579e 100644 (file)
@@ -1075,9 +1075,10 @@ static int iwl_mvm_mac_ctxt_send_beacon_v7(struct iwl_mvm *mvm,
 }
 
 bool iwl_mvm_enable_fils(struct iwl_mvm *mvm,
+                        struct ieee80211_vif *vif,
                         struct ieee80211_chanctx_conf *ctx)
 {
-       if (IWL_MVM_DISABLE_AP_FILS)
+       if (vif->type != NL80211_IFTYPE_AP || IWL_MVM_DISABLE_AP_FILS)
                return false;
 
        if (cfg80211_channel_is_psc(ctx->def.chan))
@@ -1106,7 +1107,7 @@ static int iwl_mvm_mac_ctxt_send_beacon_v9(struct iwl_mvm *mvm,
        ctx = rcu_dereference(link_conf->chanctx_conf);
        channel = ieee80211_frequency_to_channel(ctx->def.chan->center_freq);
        WARN_ON(channel == 0);
-       if (iwl_mvm_enable_fils(mvm, ctx)) {
+       if (iwl_mvm_enable_fils(mvm, vif, ctx)) {
                flags |= iwl_fw_lookup_cmd_ver(mvm->fw, BEACON_TEMPLATE_CMD,
                                               0) > 10 ?
                        IWL_MAC_BEACON_FILS :
index 5341e4ff5173a0b4f6df534a05cf9e43a79859a5..af6644b7e95fbe24210180b8806e34c59c4731b5 100644 (file)
@@ -4981,34 +4981,46 @@ int iwl_mvm_cancel_roc(struct ieee80211_hw *hw,
        return 0;
 }
 
-struct iwl_mvm_ftm_responder_iter_data {
-       bool responder;
+struct iwl_mvm_chanctx_usage_data {
+       struct iwl_mvm *mvm;
        struct ieee80211_chanctx_conf *ctx;
+       bool use_def;
 };
 
-static void iwl_mvm_ftm_responder_chanctx_iter(void *_data, u8 *mac,
-                                              struct ieee80211_vif *vif)
+static void iwl_mvm_chanctx_usage_iter(void *_data, u8 *mac,
+                                      struct ieee80211_vif *vif)
 {
-       struct iwl_mvm_ftm_responder_iter_data *data = _data;
+       struct iwl_mvm_chanctx_usage_data *data = _data;
+       struct ieee80211_bss_conf *link_conf;
+       int link_id;
+
+       for_each_vif_active_link(vif, link_conf, link_id) {
+               if (rcu_access_pointer(link_conf->chanctx_conf) != data->ctx)
+                       continue;
 
-       if (rcu_access_pointer(vif->bss_conf.chanctx_conf) == data->ctx &&
-           vif->type == NL80211_IFTYPE_AP && vif->bss_conf.ftmr_params)
-               data->responder = true;
+               if (iwl_mvm_enable_fils(data->mvm, vif, data->ctx))
+                       data->use_def = true;
+
+               if (vif->type == NL80211_IFTYPE_AP && link_conf->ftmr_params)
+                       data->use_def = true;
+       }
 }
 
-bool iwl_mvm_is_ftm_responder_chanctx(struct iwl_mvm *mvm,
-                                     struct ieee80211_chanctx_conf *ctx)
+struct cfg80211_chan_def *
+iwl_mvm_chanctx_def(struct iwl_mvm *mvm, struct ieee80211_chanctx_conf *ctx)
 {
-       struct iwl_mvm_ftm_responder_iter_data data = {
-               .responder = false,
+       struct iwl_mvm_chanctx_usage_data data = {
+               .mvm = mvm,
                .ctx = ctx,
+               .use_def = false,
        };
 
        ieee80211_iterate_active_interfaces_atomic(mvm->hw,
-                                       IEEE80211_IFACE_ITER_NORMAL,
-                                       iwl_mvm_ftm_responder_chanctx_iter,
-                                       &data);
-       return data.responder;
+                                                  IEEE80211_IFACE_ITER_NORMAL,
+                                                  iwl_mvm_chanctx_usage_iter,
+                                                  &data);
+
+       return data.use_def ? &ctx->def : &ctx->min_def;
 }
 
 static int __iwl_mvm_add_chanctx(struct iwl_mvm *mvm,
index fbf7306b9b6f9185159148915a97402b9f78f6fe..7fd51976924d895212561a759beed1e4cf6243a2 100644 (file)
@@ -2990,18 +2990,11 @@ int iwl_mvm_set_hw_timestamp(struct ieee80211_hw *hw,
                             struct cfg80211_set_hw_timestamp *hwts);
 int iwl_mvm_update_mu_groups(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
 bool iwl_mvm_enable_fils(struct iwl_mvm *mvm,
+                        struct ieee80211_vif *vif,
                         struct ieee80211_chanctx_conf *ctx);
-bool iwl_mvm_is_ftm_responder_chanctx(struct iwl_mvm *mvm,
-                                     struct ieee80211_chanctx_conf *ctx);
 
-static inline struct cfg80211_chan_def *
-iwl_mvm_chanctx_def(struct iwl_mvm *mvm, struct ieee80211_chanctx_conf *ctx)
-{
-       bool use_def = iwl_mvm_is_ftm_responder_chanctx(mvm, ctx) ||
-               iwl_mvm_enable_fils(mvm, ctx);
-
-       return use_def ? &ctx->def : &ctx->min_def;
-}
+struct cfg80211_chan_def *
+iwl_mvm_chanctx_def(struct iwl_mvm *mvm, struct ieee80211_chanctx_conf *ctx);
 
 void iwl_mvm_roc_duration_and_delay(struct ieee80211_vif *vif,
                                    u32 duration_ms,