]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: iwlwifi: mvm: properly set the rates in link cmd
authorMiri Korenblit <miriam.rachel.korenblit@intel.com>
Sun, 1 Sep 2024 04:17:57 +0000 (07:17 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 3 Sep 2024 09:55:27 +0000 (11:55 +0200)
When a channel ctx is assigned to a link, we set the
LINK_CONTEXT_MODIFY_RATES_INFO to indicate that the rate fields are now
valid. But then we always take the rates of 2.4 GHz regardless of actual
used band.
This is because we are getting the band from bss_conf->chanctx_conf, but
this is assigned only after drv_assign_vif_chanctx returns, so we take
the bands of 2.4 GHz.
Fix it by taking the band from the iwl_mvm_link_info::phy_ctxt instead,
as this has already assigned in this point.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Link: https://patch.msgid.link/20240901071542.11c2d3609609.I8fa59e29b6bb38e5d06f3536d54dfb2c5d5bab11@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/link.c
drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h

index bc8d0612774774e3b06d53ba7fc556d57d80c5ea..2b06521680020c6f7d31fa5801073a9fabca2f19 100644 (file)
@@ -264,7 +264,7 @@ int iwl_mvm_link_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
        if (vif->type == NL80211_IFTYPE_ADHOC && link_conf->bssid)
                memcpy(cmd.ibss_bssid_addr, link_conf->bssid, ETH_ALEN);
 
-       iwl_mvm_set_fw_basic_rates(mvm, vif, link_conf,
+       iwl_mvm_set_fw_basic_rates(mvm, vif, link_info,
                                   &cmd.cck_rates, &cmd.ofdm_rates);
 
        cmd.cck_short_preamble = cpu_to_le32(link_conf->use_short_preamble);
index bbddd984ddf9c7175796e6cb8ba1a73090455541..a7a10e716e651702848f4da053126d0efdf648e6 100644 (file)
@@ -413,19 +413,18 @@ static void iwl_mvm_ack_rates(struct iwl_mvm *mvm,
 }
 
 void iwl_mvm_set_fw_basic_rates(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
-                               struct ieee80211_bss_conf *link_conf,
+                               struct iwl_mvm_vif_link_info *link_info,
                                __le32 *cck_rates, __le32 *ofdm_rates)
 {
-       struct ieee80211_chanctx_conf *chanctx;
+       struct iwl_mvm_phy_ctxt *phy_ctxt;
        u8 cck_ack_rates = 0, ofdm_ack_rates = 0;
+       enum nl80211_band band = NL80211_BAND_2GHZ;
 
-       rcu_read_lock();
-       chanctx = rcu_dereference(link_conf->chanctx_conf);
-       iwl_mvm_ack_rates(mvm, vif, chanctx ? chanctx->def.chan->band
-                                           : NL80211_BAND_2GHZ,
-                         &cck_ack_rates, &ofdm_ack_rates);
+       phy_ctxt = link_info->phy_ctxt;
+       if (phy_ctxt && phy_ctxt->channel)
+               band = phy_ctxt->channel->band;
 
-       rcu_read_unlock();
+       iwl_mvm_ack_rates(mvm, vif, band, &cck_ack_rates, &ofdm_ack_rates);
 
        *cck_rates = cpu_to_le32((u32)cck_ack_rates);
        *ofdm_rates = cpu_to_le32((u32)ofdm_ack_rates);
@@ -563,7 +562,7 @@ static void iwl_mvm_mac_ctxt_cmd_common(struct iwl_mvm *mvm,
        else
                eth_broadcast_addr(cmd->bssid_addr);
 
-       iwl_mvm_set_fw_basic_rates(mvm, vif, &vif->bss_conf, &cmd->cck_rates,
+       iwl_mvm_set_fw_basic_rates(mvm, vif, &mvmvif->deflink, &cmd->cck_rates,
                                   &cmd->ofdm_rates);
 
        cmd->cck_short_preamble =
index 650b562a22cde2de87ced16641721057c1e3432b..c9b69c3a61fc9a0ad8e39891db399741d2f34f96 100644 (file)
@@ -2016,7 +2016,7 @@ int iwl_mvm_phy_send_rlc(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt,
 void iwl_mvm_prepare_mac_removal(struct iwl_mvm *mvm,
                                 struct ieee80211_vif *vif);
 void iwl_mvm_set_fw_basic_rates(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
-                               struct ieee80211_bss_conf *link_conf,
+                               struct iwl_mvm_vif_link_info *link_info,
                                __le32 *cck_rates, __le32 *ofdm_rates);
 void iwl_mvm_set_fw_protection_flags(struct iwl_mvm *mvm,
                                     struct ieee80211_vif *vif,