developer | c2cfe0f | 2023-09-22 04:11:09 +0800 | [diff] [blame] | 1 | From f0e42c5a5ea3491be2d7c61c798dffe126eabd2b Mon Sep 17 00:00:00 2001 |
| 2 | From: StanleyYP Wang <StanleyYP.Wang@mediatek.com> |
| 3 | Date: Wed, 5 Jul 2023 09:49:02 +0800 |
| 4 | Subject: [PATCH 1004/1006] cfg80211: mtk: add support for updating background |
| 5 | channel |
| 6 | |
| 7 | Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com> |
| 8 | --- |
| 9 | include/net/cfg80211.h | 14 ++++++++++++++ |
| 10 | include/uapi/linux/nl80211.h | 6 ++++++ |
| 11 | net/wireless/mlme.c | 12 ++++++++++++ |
| 12 | 3 files changed, 32 insertions(+) |
| 13 | |
| 14 | diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h |
| 15 | index 2c51c3e..46c477a 100644 |
| 16 | --- a/include/net/cfg80211.h |
| 17 | +++ b/include/net/cfg80211.h |
| 18 | @@ -8444,6 +8444,20 @@ void cfg80211_sta_update_dfs_state(struct wireless_dev *wdev, |
| 19 | const struct cfg80211_chan_def *csa_chandef, |
| 20 | bool associated); |
| 21 | |
| 22 | +/** |
| 23 | + * cfg80211_background_radar_update_channel - notify background chandef has been updated |
| 24 | + * @wiphy: the wiphy |
| 25 | + * @chandef: the updated chandef |
| 26 | + * @expand: whether or not the operating channel should expand its width |
| 27 | + * after offchan CAC |
| 28 | + * |
| 29 | + * Update the background chandef based on driver's decision, and notify the userspace |
| 30 | + * that the current channel of background chain should be updated. |
| 31 | + */ |
| 32 | +void cfg80211_background_radar_update_channel(struct wiphy *wiphy, |
| 33 | + const struct cfg80211_chan_def *chandef, |
| 34 | + bool expand); |
| 35 | + |
| 36 | /** |
| 37 | * cfg80211_background_cac_abort - Channel Availability Check offchan abort event |
| 38 | * @wiphy: the wiphy |
| 39 | diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h |
| 40 | index 60c6f79..6e96ad9 100644 |
| 41 | --- a/include/uapi/linux/nl80211.h |
| 42 | +++ b/include/uapi/linux/nl80211.h |
| 43 | @@ -6671,6 +6671,10 @@ enum nl80211_smps_mode { |
| 44 | * applicable for ETSI dfs domain where pre-CAC is valid for ever. |
| 45 | * @NL80211_RADAR_CAC_STARTED: Channel Availability Check has been started, |
| 46 | * should be generated by HW if NL80211_EXT_FEATURE_DFS_OFFLOAD is enabled. |
| 47 | + * @NL80211_RADAR_BACKGROUND_CHAN_UPDATE: background channel is updated by the |
| 48 | + * driver. |
| 49 | + * @NL80211_RADAR_BACKGROUND_CHAN_EXPAND: background channel is updated by the |
| 50 | + * driver and required to expand main operating channel. |
| 51 | * @NL80211_RADAR_STA_CAC_SKIPPED: STA set the DFS state to available |
| 52 | * when receiving CSA/assoc resp |
| 53 | * @NL80211_RADAR_STA_CAC_EXPIRED: STA set the DFS state to usable |
| 54 | @@ -6683,6 +6687,8 @@ enum nl80211_radar_event { |
| 55 | NL80211_RADAR_NOP_FINISHED, |
| 56 | NL80211_RADAR_PRE_CAC_EXPIRED, |
| 57 | NL80211_RADAR_CAC_STARTED, |
| 58 | + NL80211_RADAR_BACKGROUND_CHAN_UPDATE, |
| 59 | + NL80211_RADAR_BACKGROUND_CHAN_EXPAND, |
| 60 | NL80211_RADAR_STA_CAC_SKIPPED, |
| 61 | NL80211_RADAR_STA_CAC_EXPIRED, |
| 62 | }; |
| 63 | diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c |
| 64 | index d345c72..5510d77 100644 |
| 65 | --- a/net/wireless/mlme.c |
| 66 | +++ b/net/wireless/mlme.c |
| 67 | @@ -1158,6 +1158,18 @@ cfg80211_start_background_radar_detection(struct cfg80211_registered_device *rde |
| 68 | return 0; |
| 69 | } |
| 70 | |
| 71 | +void cfg80211_background_radar_update_channel(struct wiphy *wiphy, |
| 72 | + const struct cfg80211_chan_def *chandef, |
| 73 | + bool expand) |
| 74 | +{ |
| 75 | + enum nl80211_radar_event event; |
| 76 | + |
| 77 | + event = expand ? NL80211_RADAR_BACKGROUND_CHAN_EXPAND : |
| 78 | + NL80211_RADAR_BACKGROUND_CHAN_UPDATE; |
| 79 | + nl80211_radar_notify(wiphy_to_rdev(wiphy), chandef, event, NULL, GFP_ATOMIC); |
| 80 | +} |
| 81 | +EXPORT_SYMBOL(cfg80211_background_radar_update_channel); |
| 82 | + |
| 83 | void cfg80211_stop_background_radar_detection(struct wireless_dev *wdev) |
| 84 | { |
| 85 | struct wiphy *wiphy = wdev->wiphy; |
| 86 | -- |
| 87 | 2.39.2 |
| 88 | |