wifi: iwlwifi: adjust rx_phyinfo debugfs to MLO
authorMiri Korenblit <miriam.rachel.korenblit@intel.com>
Sun, 4 Feb 2024 22:06:08 +0000 (00:06 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 8 Feb 2024 14:00:46 +0000 (15:00 +0100)
This debugfs entry is used to configure the rx_phyinfo.
Currently we are sending the phy cmd only for the deflink.
Change it to send the cmd for all active links of the vif

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://msgid.link/20240204235836.a68ee2b6cb58.Iddc47c608ec990b12be0ae5b1ee89bcf6beb0f6a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c

index e8b881596baf12372f4807d86dd68fb88346744b..2b96cf9eac72b8d75b5a84e1d6265507fcbab778 100644 (file)
@@ -578,34 +578,46 @@ static ssize_t iwl_dbgfs_rx_phyinfo_write(struct ieee80211_vif *vif, char *buf,
 {
        struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
        struct iwl_mvm *mvm = mvmvif->mvm;
-       struct ieee80211_chanctx_conf *chanctx_conf;
-       struct iwl_mvm_phy_ctxt *phy_ctxt;
+       struct ieee80211_bss_conf *link_conf;
        u16 value;
-       int ret;
+       int link_id, ret = -EINVAL;
 
        ret = kstrtou16(buf, 0, &value);
        if (ret)
                return ret;
 
        mutex_lock(&mvm->mutex);
-       rcu_read_lock();
 
-       chanctx_conf = rcu_dereference(vif->bss_conf.chanctx_conf);
-       /* make sure the channel context is assigned */
-       if (!chanctx_conf) {
+       mvm->dbgfs_rx_phyinfo = value;
+
+       for_each_vif_active_link(vif, link_conf, link_id) {
+               struct ieee80211_chanctx_conf *chanctx_conf;
+               struct cfg80211_chan_def min_def;
+               struct iwl_mvm_phy_ctxt *phy_ctxt;
+               u8 chains_static, chains_dynamic;
+
+               rcu_read_lock();
+               chanctx_conf = rcu_dereference(link_conf->chanctx_conf);
+               if (!chanctx_conf) {
+                       rcu_read_unlock();
+                       continue;
+               }
+               /* A command can't be sent with RCU lock held, so copy
+                * everything here and use it after unlocking
+                */
+               min_def = chanctx_conf->min_def;
+               chains_static = chanctx_conf->rx_chains_static;
+               chains_dynamic = chanctx_conf->rx_chains_dynamic;
                rcu_read_unlock();
-               mutex_unlock(&mvm->mutex);
-               return -EINVAL;
-       }
 
-       phy_ctxt = &mvm->phy_ctxts[*(u16 *)chanctx_conf->drv_priv];
-       rcu_read_unlock();
+               phy_ctxt = mvmvif->link[link_id]->phy_ctxt;
+               if (!phy_ctxt)
+                       continue;
 
-       mvm->dbgfs_rx_phyinfo = value;
+               ret = iwl_mvm_phy_ctxt_changed(mvm, phy_ctxt, &min_def,
+                                              chains_static, chains_dynamic);
+       }
 
-       ret = iwl_mvm_phy_ctxt_changed(mvm, phy_ctxt, &chanctx_conf->min_def,
-                                      chanctx_conf->rx_chains_static,
-                                      chanctx_conf->rx_chains_dynamic);
        mutex_unlock(&mvm->mutex);
 
        return ret ?: count;