eb80afbccbc2a7b8679e69e9ee9d1ee872751cce
[openwrt/staging/neocturne.git] /
1 From: Lorenzo Bianconi <lorenzo@kernel.org>
2 Date: Sat, 23 Oct 2021 11:10:51 +0200
3 Subject: [PATCH] mac80211: introduce set_radar_offchan callback
4
5 Similar to cfg80211, introduce set_radar_offchan callback in mac80211_ops
6 in order to configure a dedicated offchannel chain available on some hw
7 (e.g. mt7915) to perform offchannel CAC detection and avoid tx/rx downtime.
8
9 Tested-by: Evelyn Tsai <evelyn.tsai@mediatek.com>
10 Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
11 Link: https://lore.kernel.org/r/201110606d4f3a7dfdf31440e351f2e2c375d4f0.1634979655.git.lorenzo@kernel.org
12 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
13 ---
14
15 --- a/include/net/mac80211.h
16 +++ b/include/net/mac80211.h
17 @@ -3937,6 +3937,14 @@ struct ieee80211_prep_tx_info {
18 * twt structure.
19 * @twt_teardown_request: Update the hw with TWT teardown request received
20 * from the peer.
21 + * @set_radar_offchan: Configure dedicated offchannel chain available for
22 + * radar/CAC detection on some hw. This chain can't be used to transmit
23 + * or receive frames and it is bounded to a running wdev.
24 + * Offchannel radar/CAC detection allows to avoid the CAC downtime
25 + * switching to a different channel during CAC detection on the selected
26 + * radar channel.
27 + * The caller is expected to set chandef pointer to NULL in order to
28 + * disable offchannel CAC/radar detection.
29 * @net_fill_forward_path: Called from .ndo_fill_forward_path in order to
30 * resolve a path for hardware flow offloading
31 */
32 @@ -4267,6 +4275,8 @@ struct ieee80211_ops {
33 struct ieee80211_twt_setup *twt);
34 void (*twt_teardown_request)(struct ieee80211_hw *hw,
35 struct ieee80211_sta *sta, u8 flowid);
36 + int (*set_radar_offchan)(struct ieee80211_hw *hw,
37 + struct cfg80211_chan_def *chandef);
38 #if LINUX_VERSION_IS_GEQ(5,10,0)
39 int (*net_fill_forward_path)(struct ieee80211_hw *hw,
40 struct ieee80211_vif *vif,
41 --- a/net/mac80211/cfg.c
42 +++ b/net/mac80211/cfg.c
43 @@ -4344,6 +4344,18 @@ out:
44 return err;
45 }
46
47 +static int
48 +ieee80211_set_radar_offchan(struct wiphy *wiphy,
49 + struct cfg80211_chan_def *chandef)
50 +{
51 + struct ieee80211_local *local = wiphy_priv(wiphy);
52 +
53 + if (!local->ops->set_radar_offchan)
54 + return -EOPNOTSUPP;
55 +
56 + return local->ops->set_radar_offchan(&local->hw, chandef);
57 +}
58 +
59 const struct cfg80211_ops mac80211_config_ops = {
60 .add_virtual_intf = ieee80211_add_iface,
61 .del_virtual_intf = ieee80211_del_iface,
62 @@ -4448,4 +4460,5 @@ const struct cfg80211_ops mac80211_confi
63 .reset_tid_config = ieee80211_reset_tid_config,
64 .set_sar_specs = ieee80211_set_sar_specs,
65 .color_change = ieee80211_color_change,
66 + .set_radar_offchan = ieee80211_set_radar_offchan,
67 };