wifi: iwlwifi: mld: enable OMI bandwidth reduction on 6 GHz

Due to the iwl_mld_get_chandef_from_chanctx() logic, even after
the OMI handshake to reduce bandwidth the driver wouldn't apply
that to the PHY context, since it always uses the normal, not
the reduced, configuration on 6 GHz (not strictly always, but
OMI will only apply if the original bandwidth is > 80 MHz.) Fix
this by making that selection contingent on AP mode. Refactor
the code a bit to also make it clearer why the min_def isn't
used in that case (for FILS.)

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250309073442.2706cbd0b100.Ic34636b1aee81a140eb690fca8139909a58f8e8b@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Johannes Berg 2025-03-09 07:36:47 +02:00
parent b807dec3e8
commit fd04fbee7f
5 changed files with 51 additions and 11 deletions

View File

@ -67,7 +67,7 @@ static void iwl_mld_fill_rates(struct iwl_mld *mld,
__le32 *cck_rates, __le32 *ofdm_rates)
{
struct cfg80211_chan_def *chandef =
iwl_mld_get_chandef_from_chanctx(chan_ctx);
iwl_mld_get_chandef_from_chanctx(mld, chan_ctx);
struct ieee80211_supported_band *sband =
mld->hw->wiphy->bands[chandef->chan->band];
unsigned long basic = link->basic_rates;

View File

@ -840,7 +840,7 @@ int iwl_mld_add_chanctx(struct ieee80211_hw *hw,
phy->mld = mld;
phy->fw_id = fw_id;
phy->chandef = *iwl_mld_get_chandef_from_chanctx(ctx);
phy->chandef = *iwl_mld_get_chandef_from_chanctx(mld, ctx);
ret = iwl_mld_phy_fw_action(mld, ctx, FW_CTXT_ACTION_ADD);
if (ret) {
@ -872,7 +872,7 @@ void iwl_mld_change_chanctx(struct ieee80211_hw *hw,
struct iwl_mld *mld = IWL_MAC80211_GET_MLD(hw);
struct iwl_mld_phy *phy = iwl_mld_phy_from_mac80211(ctx);
struct cfg80211_chan_def *chandef =
iwl_mld_get_chandef_from_chanctx(ctx);
iwl_mld_get_chandef_from_chanctx(mld, ctx);
/* We don't care about these */
if (!(changed & ~(IEEE80211_CHANCTX_CHANGE_RX_CHAINS |

View File

@ -22,16 +22,55 @@ int iwl_mld_allocate_fw_phy_id(struct iwl_mld *mld)
}
EXPORT_SYMBOL_IF_IWLWIFI_KUNIT(iwl_mld_allocate_fw_phy_id);
struct cfg80211_chan_def *
iwl_mld_get_chandef_from_chanctx(struct ieee80211_chanctx_conf *ctx)
struct iwl_mld_chanctx_usage_data {
struct iwl_mld *mld;
struct ieee80211_chanctx_conf *ctx;
bool use_def;
};
static bool iwl_mld_chanctx_fils_enabled(struct ieee80211_vif *vif,
struct ieee80211_chanctx_conf *ctx)
{
bool use_def = cfg80211_channel_is_psc(ctx->def.chan) ||
if (vif->type != NL80211_IFTYPE_AP)
return false;
return cfg80211_channel_is_psc(ctx->def.chan) ||
(ctx->def.chan->band == NL80211_BAND_6GHZ &&
ctx->def.width >= NL80211_CHAN_WIDTH_80);
return use_def ? &ctx->def : &ctx->min_def;
}
EXPORT_SYMBOL_IF_IWLWIFI_KUNIT(iwl_mld_get_chandef_from_chanctx);
static void iwl_mld_chanctx_usage_iter(void *_data, u8 *mac,
struct ieee80211_vif *vif)
{
struct iwl_mld_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 (iwl_mld_chanctx_fils_enabled(vif, data->ctx))
data->use_def = true;
}
}
struct cfg80211_chan_def *
iwl_mld_get_chandef_from_chanctx(struct iwl_mld *mld,
struct ieee80211_chanctx_conf *ctx)
{
struct iwl_mld_chanctx_usage_data data = {
.mld = mld,
.ctx = ctx,
};
ieee80211_iterate_active_interfaces_mtx(mld->hw,
IEEE80211_IFACE_ITER_NORMAL,
iwl_mld_chanctx_usage_iter,
&data);
return data.use_def ? &ctx->def : &ctx->min_def;
}
static u8
iwl_mld_nl80211_width_to_fw(enum nl80211_chan_width width)

View File

@ -48,7 +48,8 @@ int iwl_mld_allocate_fw_phy_id(struct iwl_mld *mld);
int iwl_mld_phy_fw_action(struct iwl_mld *mld,
struct ieee80211_chanctx_conf *ctx, u32 action);
struct cfg80211_chan_def *
iwl_mld_get_chandef_from_chanctx(struct ieee80211_chanctx_conf *ctx);
iwl_mld_get_chandef_from_chanctx(struct iwl_mld *mld,
struct ieee80211_chanctx_conf *ctx);
u8 iwl_mld_get_fw_ctrl_pos(const struct cfg80211_chan_def *chandef);
#endif /* __iwl_mld_phy_h__ */

View File

@ -169,7 +169,7 @@ iwlmld_kunit_add_chanctx_from_def(struct cfg80211_chan_def *def)
phy->fw_id = fw_id;
phy->mld = mld;
phy->chandef = *iwl_mld_get_chandef_from_chanctx(ctx);
phy->chandef = *def;
return ctx;
}