wifi: iwlwifi: mld: KUnit: create chanctx with a custom width

Currently iwlmld_kunit_add_chanctx receives a band, picks a predefined
static chandef, and creates the chanctx from it.
Change it to receive a bandwidth as well. Otherwise, the bandwidth in
the chanctx/phy will be different than what test specified in the
iwl_mld_kunit_link.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Link: https://patch.msgid.link/20250313002008.85a1285d34cd.Ia71cdcd4241fe73501bc93e3cb2c6bb3f631b9ec@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Miri Korenblit 2025-03-13 00:22:32 +02:00 committed by Johannes Berg
parent de5ca699bc
commit 2907c039ff
2 changed files with 11 additions and 8 deletions

View File

@ -346,7 +346,8 @@ iwlmld_kunit_setup_assoc(bool mlo, struct iwl_mld_kunit_link *assoc_link)
else
link = &vif->bss_conf;
chan_ctx = iwlmld_kunit_add_chanctx(assoc_link->band);
chan_ctx = iwlmld_kunit_add_chanctx(assoc_link->band,
assoc_link->bandwidth);
wiphy_lock(mld->wiphy);
iwlmld_kunit_assign_chanctx_to_link(vif, link, chan_ctx);
@ -427,7 +428,7 @@ struct ieee80211_vif *iwlmld_kunit_assoc_emlsr(struct iwl_mld_kunit_link *link1,
link = wiphy_dereference(mld->wiphy, vif->link_conf[link2->id]);
KUNIT_EXPECT_NOT_NULL(test, link);
chan_ctx = iwlmld_kunit_add_chanctx(link2->band);
chan_ctx = iwlmld_kunit_add_chanctx(link2->band, link2->bandwidth);
iwlmld_kunit_assign_chanctx_to_link(vif, link, chan_ctx);
wiphy_unlock(mld->wiphy);

View File

@ -65,24 +65,26 @@ struct ieee80211_chanctx_conf *
iwlmld_kunit_add_chanctx_from_def(struct cfg80211_chan_def *def);
static inline struct ieee80211_chanctx_conf *
iwlmld_kunit_add_chanctx(enum nl80211_band band)
iwlmld_kunit_add_chanctx(enum nl80211_band band, enum nl80211_chan_width width)
{
struct cfg80211_chan_def *chandef;
struct cfg80211_chan_def chandef;
switch (band) {
case NL80211_BAND_2GHZ:
chandef = &chandef_2ghz;
chandef = chandef_2ghz;
break;
case NL80211_BAND_5GHZ:
chandef = &chandef_5ghz;
chandef = chandef_5ghz;
break;
default:
case NL80211_BAND_6GHZ:
chandef = &chandef_6ghz;
chandef = chandef_6ghz;
break;
}
return iwlmld_kunit_add_chanctx_from_def(chandef);
chandef.width = width;
return iwlmld_kunit_add_chanctx_from_def(&chandef);
}
void iwlmld_kunit_assign_chanctx_to_link(struct ieee80211_vif *vif,