Skip to content

Commit

Permalink
wifi: iwlwifi: mvm: improve/fix chanctx min_def use logic
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Johannes Berg committed Jan 13, 2025
1 parent 9a2f13c commit 9eca1ab
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 28 deletions.
5 changes: 3 additions & 2 deletions drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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 :
Expand Down
44 changes: 28 additions & 16 deletions drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
13 changes: 3 additions & 10 deletions drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 9eca1ab

Please sign in to comment.