wifi: mac80211: add support to call csa_finish on a link
authorAditya Kumar Singh <quic_adisi@quicinc.com>
Tue, 30 Jan 2024 14:09:18 +0000 (19:39 +0530)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 8 Feb 2024 14:00:45 +0000 (15:00 +0100)
Currently ieee80211_csa_finish() function finalizes CSA by scheduling a
finalizing worker using the deflink. With MLO, there is a need to do it
on a given link basis.

Pass link ID of the link on which CSA needs to be finalized.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
Link: https://msgid.link/20240130140918.1172387-6-quic_adisi@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
17 files changed:
drivers/net/wireless/ath/ath10k/mac.c
drivers/net/wireless/ath/ath10k/wmi.c
drivers/net/wireless/ath/ath11k/wmi.c
drivers/net/wireless/ath/ath12k/wmi.c
drivers/net/wireless/ath/ath9k/beacon.c
drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
drivers/net/wireless/intel/iwlwifi/mvm/time-event.c
drivers/net/wireless/mediatek/mt76/mac80211.c
drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
drivers/net/wireless/ti/wlcore/event.c
drivers/net/wireless/virtual/mac80211_hwsim.c
include/net/mac80211.h
net/mac80211/cfg.c

index b802204..4105321 100644 (file)
@@ -2047,7 +2047,7 @@ static void ath10k_mac_vif_ap_csa_count_down(struct ath10k_vif *arvif)
                        ath10k_warn(ar, "failed to update prb tmpl during csa: %d\n",
                                    ret);
        } else {
-               ieee80211_csa_finish(vif);
+               ieee80211_csa_finish(vif, 0);
        }
 }
 
index 9e2f0a5..ddf1571 100644 (file)
@@ -3885,7 +3885,7 @@ void ath10k_wmi_event_host_swba(struct ath10k *ar, struct sk_buff *skb)
                 */
                if (arvif->vif->bss_conf.csa_active &&
                    ieee80211_beacon_cntdwn_is_complete(arvif->vif)) {
-                       ieee80211_csa_finish(arvif->vif);
+                       ieee80211_csa_finish(arvif->vif, 0);
                        continue;
                }
 
index 688ee20..3c9f3b0 100644 (file)
@@ -8226,7 +8226,7 @@ ath11k_wmi_process_csa_switch_count_event(struct ath11k_base *ab,
                }
 
                if (arvif->is_up && arvif->vif->bss_conf.csa_active)
-                       ieee80211_csa_finish(arvif->vif);
+                       ieee80211_csa_finish(arvif->vif, 0);
        }
        rcu_read_unlock();
 }
index 2fa724e..75c3a0d 100644 (file)
@@ -6448,7 +6448,7 @@ ath12k_wmi_process_csa_switch_count_event(struct ath12k_base *ab,
                }
 
                if (arvif->is_up && arvif->vif->bss_conf.csa_active)
-                       ieee80211_csa_finish(arvif->vif);
+                       ieee80211_csa_finish(arvif->vif, 0);
        }
        rcu_read_unlock();
 }
index ee72faa..4e48407 100644 (file)
@@ -368,7 +368,7 @@ bool ath9k_csa_is_finished(struct ath_softc *sc, struct ieee80211_vif *vif)
        if (!ieee80211_beacon_cntdwn_is_complete(vif))
                return false;
 
-       ieee80211_csa_finish(vif);
+       ieee80211_csa_finish(vif, 0);
        return true;
 }
 
index 533471e..8179d35 100644 (file)
@@ -517,7 +517,7 @@ bool ath9k_htc_csa_is_finished(struct ath9k_htc_priv *priv)
        if (!ieee80211_beacon_cntdwn_is_complete(vif))
                return false;
 
-       ieee80211_csa_finish(vif);
+       ieee80211_csa_finish(vif, 0);
 
        priv->csa_vif = NULL;
        return true;
index 3dea06b..7cb6bc9 100644 (file)
@@ -1486,7 +1486,7 @@ static void iwl_mvm_csa_count_down(struct iwl_mvm *mvm,
                }
        } else if (!iwl_mvm_te_scheduled(&mvmvif->time_event_data)) {
                /* we don't have CSA NoA scheduled yet, switch now */
-               ieee80211_csa_finish(csa_vif);
+               ieee80211_csa_finish(csa_vif, 0);
                RCU_INIT_POINTER(mvm->csa_vif, NULL);
        }
 }
@@ -1836,7 +1836,7 @@ void iwl_mvm_channel_switch_start_notif(struct iwl_mvm *mvm,
                                      msecs_to_jiffies(IWL_MVM_CS_UNBLOCK_TX_TIMEOUT *
                                                       csa_vif->bss_conf.beacon_int));
 
-               ieee80211_csa_finish(csa_vif);
+               ieee80211_csa_finish(csa_vif, 0);
 
                rcu_read_unlock();
 
index 60ec5ca..b7461bc 100644 (file)
@@ -168,7 +168,7 @@ static void iwl_mvm_csa_noa_start(struct iwl_mvm *mvm)
                goto out_unlock;
        }
 
-       ieee80211_csa_finish(csa_vif);
+       ieee80211_csa_finish(csa_vif, 0);
 
        rcu_read_unlock();
 
index 8a3a90d..8bf8275 100644 (file)
@@ -1614,7 +1614,7 @@ static void
 __mt76_csa_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
 {
        if (vif->bss_conf.csa_active && ieee80211_beacon_cntdwn_is_complete(vif))
-               ieee80211_csa_finish(vif);
+               ieee80211_csa_finish(vif, 0);
 }
 
 void mt76_csa_finish(struct mt76_dev *dev)
index ae34d01..c807bd8 100644 (file)
@@ -353,7 +353,7 @@ static void
 mt7615_mcu_csa_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
 {
        if (vif->bss_conf.csa_active)
-               ieee80211_csa_finish(vif);
+               ieee80211_csa_finish(vif, 0);
 }
 
 static void
index df1ad6d..d90f98c 100644 (file)
@@ -228,7 +228,7 @@ mt7915_mcu_csa_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
        if (!vif->bss_conf.csa_active || vif->type == NL80211_IFTYPE_STATION)
                return;
 
-       ieee80211_csa_finish(vif);
+       ieee80211_csa_finish(vif, 0);
 }
 
 static void
index 699be57..3ec8130 100644 (file)
@@ -341,7 +341,7 @@ mt7996_mcu_csa_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
        if (!vif->bss_conf.csa_active || vif->type == NL80211_IFTYPE_STATION)
                return;
 
-       ieee80211_csa_finish(vif);
+       ieee80211_csa_finish(vif, 0);
 }
 
 static void
index b0c1db7..66bf92c 100644 (file)
@@ -5740,7 +5740,7 @@ static void rtl8xxxu_update_beacon_work_callback(struct work_struct *work)
 
        if (vif->bss_conf.csa_active) {
                if (ieee80211_beacon_cntdwn_is_complete(vif)) {
-                       ieee80211_csa_finish(vif);
+                       ieee80211_csa_finish(vif, 0);
                        return;
                }
                schedule_delayed_work(&priv->update_beacon_work,
index 1e082d0..2499dc9 100644 (file)
@@ -233,7 +233,7 @@ void wlcore_event_channel_switch(struct wl1271 *wl,
                        cancel_delayed_work(&wlvif->channel_switch_work);
                } else {
                        set_bit(WLVIF_FLAG_BEACON_DISABLED, &wlvif->flags);
-                       ieee80211_csa_finish(vif);
+                       ieee80211_csa_finish(vif, 0);
                }
        }
 }
index 907c084..c337afd 100644 (file)
@@ -2303,7 +2303,7 @@ static void mac80211_hwsim_beacon_tx(void *arg, u8 *mac,
        }
 
        if (link_conf->csa_active && ieee80211_beacon_cntdwn_is_complete(vif))
-               ieee80211_csa_finish(vif);
+               ieee80211_csa_finish(vif, link_id);
 }
 
 static enum hrtimer_restart
index 8acee7c..45d905b 100644 (file)
@@ -5555,12 +5555,13 @@ void ieee80211_beacon_set_cntdwn(struct ieee80211_vif *vif, u8 counter);
 /**
  * ieee80211_csa_finish - notify mac80211 about channel switch
  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
+ * @link_id: valid link_id during MLO or 0 for non-MLO
  *
  * After a channel switch announcement was scheduled and the counter in this
  * announcement hits 1, this function must be called by the driver to
  * notify mac80211 that the channel can be changed.
  */
-void ieee80211_csa_finish(struct ieee80211_vif *vif);
+void ieee80211_csa_finish(struct ieee80211_vif *vif, unsigned int link_id);
 
 /**
  * ieee80211_beacon_cntdwn_is_complete - find out if countdown reached 1
index d30a64c..156a421 100644 (file)
@@ -3547,13 +3547,24 @@ cfg80211_beacon_dup(struct cfg80211_beacon_data *beacon)
        return new_beacon;
 }
 
-void ieee80211_csa_finish(struct ieee80211_vif *vif)
+void ieee80211_csa_finish(struct ieee80211_vif *vif, unsigned int link_id)
 {
        struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
        struct ieee80211_local *local = sdata->local;
+       struct ieee80211_link_data *link_data;
+
+       if (WARN_ON(link_id >= IEEE80211_MLD_MAX_NUM_LINKS))
+               return;
 
        rcu_read_lock();
 
+       link_data = rcu_dereference(sdata->link[link_id]);
+       if (WARN_ON(!link_data)) {
+               rcu_read_unlock();
+               return;
+       }
+
+       /* TODO: MBSSID with MLO changes */
        if (vif->mbssid_tx_vif == vif) {
                /* Trigger ieee80211_csa_finish() on the non-transmitting
                 * interfaces when channel switch is received on
@@ -3572,7 +3583,7 @@ void ieee80211_csa_finish(struct ieee80211_vif *vif)
                                         &iter->deflink.csa_finalize_work);
                }
        }
-       wiphy_work_queue(local->hw.wiphy, &sdata->deflink.csa_finalize_work);
+       wiphy_work_queue(local->hw.wiphy, &link_data->csa_finalize_work);
 
        rcu_read_unlock();
 }