wifi: iwlwifi: mvm: FTM responder MLO support
authorAvraham Stern <avraham.stern@intel.com>
Mon, 12 Jun 2023 15:51:15 +0000 (18:51 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 14 Jun 2023 10:32:18 +0000 (12:32 +0200)
Add a link configuration parameter to FTM responder start instead
of using the default link.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230612184434.b367f9bd19b8.I158c71998f39a6c15463ff5ae30129da8ad46d22@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/ftm-responder.c
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h

index 1b6fb73ddfc784da9ee5138e62a91a5259690ff1..b49781d1a07a7a721b3e0e076f8b8487f3aac941 100644 (file)
@@ -104,7 +104,8 @@ iwl_mvm_ftm_responder_set_ndp(struct iwl_mvm *mvm,
 static int
 iwl_mvm_ftm_responder_cmd(struct iwl_mvm *mvm,
                          struct ieee80211_vif *vif,
-                         struct cfg80211_chan_def *chandef)
+                         struct cfg80211_chan_def *chandef,
+                         struct ieee80211_bss_conf *link_conf)
 {
        u32 cmd_id = WIDE_ID(LOCATION_GROUP, TOF_RESPONDER_CONFIG_CMD);
        struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
@@ -119,7 +120,7 @@ iwl_mvm_ftm_responder_cmd(struct iwl_mvm *mvm,
                        cpu_to_le32(IWL_TOF_RESPONDER_CMD_VALID_CHAN_INFO |
                                    IWL_TOF_RESPONDER_CMD_VALID_BSSID |
                                    IWL_TOF_RESPONDER_CMD_VALID_STA_ID),
-               .sta_id = mvmvif->deflink.bcast_sta.sta_id,
+               .sta_id = mvmvif->link[link_conf->link_id]->bcast_sta.sta_id,
        };
        u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id, 6);
        int err;
@@ -386,7 +387,8 @@ int iwl_mvm_ftm_resp_remove_pasn_sta(struct iwl_mvm *mvm,
        return -EINVAL;
 }
 
-int iwl_mvm_ftm_start_responder(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
+int iwl_mvm_ftm_start_responder(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
+                               struct ieee80211_bss_conf *bss_conf)
 {
        struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
        struct ieee80211_ftm_responder_params *params;
@@ -395,11 +397,11 @@ int iwl_mvm_ftm_start_responder(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
        struct iwl_mvm_phy_ctxt *phy_ctxt;
        int ret;
 
-       params = vif->bss_conf.ftmr_params;
+       params = bss_conf->ftmr_params;
 
        lockdep_assert_held(&mvm->mutex);
 
-       if (WARN_ON_ONCE(!vif->bss_conf.ftm_responder))
+       if (WARN_ON_ONCE(!bss_conf->ftm_responder))
                return -EINVAL;
 
        if (vif->p2p || vif->type != NL80211_IFTYPE_AP ||
@@ -409,7 +411,7 @@ int iwl_mvm_ftm_start_responder(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
        }
 
        rcu_read_lock();
-       pctx = rcu_dereference(vif->bss_conf.chanctx_conf);
+       pctx = rcu_dereference(bss_conf->chanctx_conf);
        /* Copy the ctx to unlock the rcu and send the phy ctxt. We don't care
         * about changes in the ctx after releasing the lock because the driver
         * is still protected by the mutex. */
@@ -424,7 +426,7 @@ int iwl_mvm_ftm_start_responder(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
        if (ret)
                return ret;
 
-       ret = iwl_mvm_ftm_responder_cmd(mvm, vif, &ctx.def);
+       ret = iwl_mvm_ftm_responder_cmd(mvm, vif, &ctx.def, bss_conf);
        if (ret)
                return ret;
 
@@ -446,13 +448,14 @@ void iwl_mvm_ftm_responder_clear(struct iwl_mvm *mvm,
 }
 
 void iwl_mvm_ftm_restart_responder(struct iwl_mvm *mvm,
-                                  struct ieee80211_vif *vif)
+                                  struct ieee80211_vif *vif,
+                                  struct ieee80211_bss_conf *bss_conf)
 {
-       if (!vif->bss_conf.ftm_responder)
+       if (!bss_conf->ftm_responder)
                return;
 
        iwl_mvm_ftm_responder_clear(mvm, vif);
-       iwl_mvm_ftm_start_responder(mvm, vif);
+       iwl_mvm_ftm_start_responder(mvm, vif, bss_conf);
 }
 
 void iwl_mvm_ftm_responder_stats(struct iwl_mvm *mvm,
index f7e2ca7eebf0ed23ece9f4e906ab9457870248bd..bf78b7df47002352ff98ec29d08d74ab7ef317b5 100644 (file)
@@ -2890,7 +2890,7 @@ static int iwl_mvm_start_ap_ibss(struct ieee80211_hw *hw,
        if (iwl_mvm_phy_ctx_count(mvm) > 1)
                iwl_mvm_teardown_tdls_peers(mvm);
 
-       iwl_mvm_ftm_restart_responder(mvm, vif);
+       iwl_mvm_ftm_restart_responder(mvm, vif, &vif->bss_conf);
 
        goto out_unlock;
 
@@ -3032,7 +3032,7 @@ iwl_mvm_bss_info_changed_ap_ibss(struct iwl_mvm *mvm,
                IWL_WARN(mvm, "Failed updating beacon data\n");
 
        if (changes & BSS_CHANGED_FTM_RESPONDER) {
-               int ret = iwl_mvm_ftm_start_responder(mvm, vif);
+               int ret = iwl_mvm_ftm_start_responder(mvm, vif, &vif->bss_conf);
 
                if (ret)
                        IWL_WARN(mvm, "Failed to enable FTM responder (%d)\n",
index 5e28a1645aa927be8409a8605006272b7066d66c..ff99bf91f9317bc30c046f177236fafd6e0347b0 100644 (file)
@@ -422,7 +422,7 @@ static int iwl_mvm_mld_start_ap_ibss(struct ieee80211_hw *hw,
        if (iwl_mvm_phy_ctx_count(mvm) > 1)
                iwl_mvm_teardown_tdls_peers(mvm);
 
-       iwl_mvm_ftm_restart_responder(mvm, vif);
+       iwl_mvm_ftm_restart_responder(mvm, vif, link_conf);
 
        goto out_unlock;
 
@@ -711,7 +711,7 @@ iwl_mvm_mld_link_info_changed_ap_ibss(struct iwl_mvm *mvm,
 
        /* FIXME: need to decide if we need FTM responder per link */
        if (changes & BSS_CHANGED_FTM_RESPONDER) {
-               int ret = iwl_mvm_ftm_start_responder(mvm, vif);
+               int ret = iwl_mvm_ftm_start_responder(mvm, vif, link_conf);
 
                if (ret)
                        IWL_WARN(mvm, "Failed to enable FTM responder (%d)\n",
index a406ea699690b98af063d9554bc139fdfc83312b..143c79f62cfde5435c0f77ee18ba612c54cb26a9 100644 (file)
@@ -2239,9 +2239,11 @@ int iwl_mvm_sf_update(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
                      bool added_vif);
 
 /* FTM responder */
-int iwl_mvm_ftm_start_responder(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
+int iwl_mvm_ftm_start_responder(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
+                               struct ieee80211_bss_conf *bss_conf);
 void iwl_mvm_ftm_restart_responder(struct iwl_mvm *mvm,
-                                  struct ieee80211_vif *vif);
+                                  struct ieee80211_vif *vif,
+                                  struct ieee80211_bss_conf *bss_conf);
 void iwl_mvm_ftm_responder_stats(struct iwl_mvm *mvm,
                                 struct iwl_rx_cmd_buffer *rxb);
 int iwl_mvm_ftm_resp_remove_pasn_sta(struct iwl_mvm *mvm,