mac80211: introduce set_radar_offchan callback
authorLorenzo Bianconi <lorenzo@kernel.org>
Sat, 23 Oct 2021 09:10:51 +0000 (11:10 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 19 Nov 2021 08:38:49 +0000 (09:38 +0100)
Similar to cfg80211, introduce set_radar_offchan callback in mac80211_ops
in order to configure a dedicated offchannel chain available on some hw
(e.g. mt7915) to perform offchannel CAC detection and avoid tx/rx downtime.

Tested-by: Evelyn Tsai <evelyn.tsai@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/201110606d4f3a7dfdf31440e351f2e2c375d4f0.1634979655.git.lorenzo@kernel.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/net/mac80211.h
net/mac80211/cfg.c

index dd757f0987b0f9c21002cdd229ad818ec0c5c5ed..775dbb98265486f206d4abde69a50620ef309196 100644 (file)
@@ -3944,6 +3944,14 @@ struct ieee80211_prep_tx_info {
  *     twt structure.
  * @twt_teardown_request: Update the hw with TWT teardown request received
  *     from the peer.
+ * @set_radar_offchan: Configure dedicated offchannel chain available for
+ *     radar/CAC detection on some hw. This chain can't be used to transmit
+ *     or receive frames and it is bounded to a running wdev.
+ *     Offchannel radar/CAC detection allows to avoid the CAC downtime
+ *     switching to a different channel during CAC detection on the selected
+ *     radar channel.
+ *     The caller is expected to set chandef pointer to NULL in order to
+ *     disable offchannel CAC/radar detection.
  */
 struct ieee80211_ops {
        void (*tx)(struct ieee80211_hw *hw,
@@ -4272,6 +4280,8 @@ struct ieee80211_ops {
                              struct ieee80211_twt_setup *twt);
        void (*twt_teardown_request)(struct ieee80211_hw *hw,
                                     struct ieee80211_sta *sta, u8 flowid);
+       int (*set_radar_offchan)(struct ieee80211_hw *hw,
+                                struct cfg80211_chan_def *chandef);
 };
 
 /**
index bd3d3195097faf2726614a6c32adc567b57455d3..45334d59fe066b9aa0e5bbd996ca3780d5de375e 100644 (file)
@@ -4383,6 +4383,18 @@ out:
        return err;
 }
 
+static int
+ieee80211_set_radar_offchan(struct wiphy *wiphy,
+                           struct cfg80211_chan_def *chandef)
+{
+       struct ieee80211_local *local = wiphy_priv(wiphy);
+
+       if (!local->ops->set_radar_offchan)
+               return -EOPNOTSUPP;
+
+       return local->ops->set_radar_offchan(&local->hw, chandef);
+}
+
 const struct cfg80211_ops mac80211_config_ops = {
        .add_virtual_intf = ieee80211_add_iface,
        .del_virtual_intf = ieee80211_del_iface,
@@ -4487,4 +4499,5 @@ const struct cfg80211_ops mac80211_config_ops = {
        .reset_tid_config = ieee80211_reset_tid_config,
        .set_sar_specs = ieee80211_set_sar_specs,
        .color_change = ieee80211_color_change,
+       .set_radar_offchan = ieee80211_set_radar_offchan,
 };