wifi: mac80211: handle ieee80211_radar_detected() for MLO
authorAditya Kumar Singh <quic_adisi@quicinc.com>
Fri, 6 Sep 2024 06:44:26 +0000 (12:14 +0530)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 6 Sep 2024 11:01:05 +0000 (13:01 +0200)
commitbca8bc0399ac2efd56e6adbed0307e10125a556c
treef64a5a599eff625ae39d788d9cb99c319a2623a5
parent0b7798232eee010d8c52e1ab5f96a1cce0d4183e
wifi: mac80211: handle ieee80211_radar_detected() for MLO

Currently DFS works under assumption there could be only one channel
context in the hardware. Hence, drivers just calls the function
ieee80211_radar_detected() passing the hardware structure. However, with
MLO, this obviously will not work since number of channel contexts will be
more than one and hence drivers would need to pass the channel information
as well on which the radar is detected.

Also, when radar is detected in one of the links, other link's CAC should
not be cancelled.

Hence, in order to support DFS with MLO, do the following changes -
  * Add channel context conf pointer as an argument to the function
    ieee80211_radar_detected(). During MLO, drivers would have to pass on
    which channel context conf radar is detected. Otherwise, drivers could
    just pass NULL.
  * ieee80211_radar_detected() will iterate over all channel contexts
    present and
   * if channel context conf is passed, only mark that as radar
     detected
   * if NULL is passed, then mark all channel contexts as radar
     detected
   * Then as usual, schedule the radar detected work.
  * In the worker, go over all the contexts again and for all such context
    which is marked with radar detected, cancel the ongoing CAC by calling
    ieee80211_dfs_cac_cancel() and then notify cfg80211 via
    cfg80211_radar_event().
  * To cancel the CAC, pass the channel context as well where radar is
    detected to ieee80211_dfs_cac_cancel(). This ensures that CAC is
    canceled only on the links using the provided context, leaving other
    links unaffected.

This would also help in scenarios where there is split phy 5 GHz radio,
which is capable of DFS channels in both lower and upper band. In this
case, simultaneous radars can be detected.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
Link: https://patch.msgid.link/20240906064426.2101315-9-quic_adisi@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
18 files changed:
drivers/net/wireless/ath/ath10k/debug.c
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/dfs.c
drivers/net/wireless/ath/ath9k/dfs_debug.c
drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
drivers/net/wireless/ti/wl18xx/event.c
drivers/net/wireless/virtual/mac80211_hwsim.c
include/net/mac80211.h
net/mac80211/chan.c
net/mac80211/ieee80211_i.h
net/mac80211/pm.c
net/mac80211/util.c