Introduce cfg80211_cac_offchan_event routine in order to notify userland when a Channel Availability Check (CAC) is finished or aborted by offchannel dedicated chain. Signed-off-by: Lorenzo Bianconi <lorenzo@xxxxxxxxxx> --- include/net/cfg80211.h | 13 +++++++++++++ net/wireless/mlme.c | 26 ++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index fa31b0919be9..7c1bcd406a34 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -7564,6 +7564,19 @@ void cfg80211_cac_event(struct net_device *netdev, const struct cfg80211_chan_def *chandef, enum nl80211_radar_event event, gfp_t gfp); +/** + * cfg80211_cac_offchan_event - Channel Availability Check (CAC) offchan event + * @wiphy: the wiphy + * @chandef: chandef for the current channel + * @event: type of event + * @gfp: context flags + * + * This function is called when a Channel Availability Check (CAC) is finished + * or aborted by offchannel dedicated chain. + */ +void cfg80211_cac_offchan_event(struct wiphy *wiphy, + const struct cfg80211_chan_def *chandef, + enum nl80211_radar_event event, gfp_t gfp); /** * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c index 3aa69b375a10..4362f4f49bb4 100644 --- a/net/wireless/mlme.c +++ b/net/wireless/mlme.c @@ -968,3 +968,29 @@ void cfg80211_cac_event(struct net_device *netdev, nl80211_radar_notify(rdev, chandef, event, netdev, gfp); } EXPORT_SYMBOL(cfg80211_cac_event); + +void cfg80211_cac_offchan_event(struct wiphy *wiphy, + const struct cfg80211_chan_def *chandef, + enum nl80211_radar_event event, gfp_t gfp) +{ + struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); + + switch (event) { + case NL80211_RADAR_CAC_FINISHED: + cfg80211_set_dfs_state(wiphy, chandef, NL80211_DFS_AVAILABLE); + memcpy(&rdev->cac_done_chandef, chandef, + sizeof(struct cfg80211_chan_def)); + queue_work(cfg80211_wq, &rdev->propagate_cac_done_wk); + cfg80211_sched_dfs_chan_update(rdev); + break; + case NL80211_RADAR_CAC_ABORTED: + case NL80211_RADAR_CAC_STARTED: + break; + default: + WARN_ON(1); + return; + } + + nl80211_radar_notify(rdev, chandef, event, NULL, gfp); +} +EXPORT_SYMBOL(cfg80211_cac_offchan_event); -- 2.31.1