aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJanusz Dziedzic <janusz.dziedzic@tieto.com>2013-11-06 07:55:51 -0500
committerJohannes Berg <johannes.berg@intel.com>2013-11-25 14:50:46 -0500
commitd2859df5e7f00469011482d850fba652517a2eab (patch)
treee43b5fe6844f412cf27fdc6aaf2d25eef90b3a81
parent5282c3ba4c5a24b2ab45a6742f9ab01a3d90c167 (diff)
cfg80211/mac80211: DFS setup chandef for cac event
To report channel width correctly we have to send correct channel parameters from mac80211 when calling cfg80211_cac_event(). This is required in case of using channel width higher than 20MHz and we have to set correct dfs channel state after CAC (NL80211_DFS_AVAILABLE). Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com> Reviewed-by: Luis R. Rodriguez <mcgrof@do-not-panic.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--include/net/cfg80211.h2
-rw-r--r--net/mac80211/cfg.c5
-rw-r--r--net/mac80211/iface.c5
-rw-r--r--net/mac80211/mlme.c6
-rw-r--r--net/mac80211/util.c3
-rw-r--r--net/wireless/mlme.c8
-rw-r--r--net/wireless/nl80211.c4
-rw-r--r--net/wireless/nl80211.h2
8 files changed, 23 insertions, 12 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index b7a825ecff56..968f2ad40ccd 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -4150,6 +4150,7 @@ void cfg80211_radar_event(struct wiphy *wiphy,
4150/** 4150/**
4151 * cfg80211_cac_event - Channel availability check (CAC) event 4151 * cfg80211_cac_event - Channel availability check (CAC) event
4152 * @netdev: network device 4152 * @netdev: network device
4153 * @chandef: chandef for the current channel
4153 * @event: type of event 4154 * @event: type of event
4154 * @gfp: context flags 4155 * @gfp: context flags
4155 * 4156 *
@@ -4158,6 +4159,7 @@ void cfg80211_radar_event(struct wiphy *wiphy,
4158 * also by full-MAC drivers. 4159 * also by full-MAC drivers.
4159 */ 4160 */
4160void cfg80211_cac_event(struct net_device *netdev, 4161void cfg80211_cac_event(struct net_device *netdev,
4162 const struct cfg80211_chan_def *chandef,
4161 enum nl80211_radar_event event, gfp_t gfp); 4163 enum nl80211_radar_event event, gfp_t gfp);
4162 4164
4163 4165
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 95667b088c5b..5232b0102143 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1050,6 +1050,7 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev)
1050 struct ieee80211_local *local = sdata->local; 1050 struct ieee80211_local *local = sdata->local;
1051 struct beacon_data *old_beacon; 1051 struct beacon_data *old_beacon;
1052 struct probe_resp *old_probe_resp; 1052 struct probe_resp *old_probe_resp;
1053 struct cfg80211_chan_def chandef;
1053 1054
1054 old_beacon = rtnl_dereference(sdata->u.ap.beacon); 1055 old_beacon = rtnl_dereference(sdata->u.ap.beacon);
1055 if (!old_beacon) 1056 if (!old_beacon)
@@ -1091,8 +1092,10 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev)
1091 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED); 1092 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED);
1092 1093
1093 if (sdata->wdev.cac_started) { 1094 if (sdata->wdev.cac_started) {
1095 chandef = sdata->vif.bss_conf.chandef;
1094 cancel_delayed_work_sync(&sdata->dfs_cac_timer_work); 1096 cancel_delayed_work_sync(&sdata->dfs_cac_timer_work);
1095 cfg80211_cac_event(sdata->dev, NL80211_RADAR_CAC_ABORTED, 1097 cfg80211_cac_event(sdata->dev, &chandef,
1098 NL80211_RADAR_CAC_ABORTED,
1096 GFP_KERNEL); 1099 GFP_KERNEL);
1097 } 1100 }
1098 1101
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index ff101ea1d9ae..c9b04425ffc7 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -749,6 +749,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
749 u32 hw_reconf_flags = 0; 749 u32 hw_reconf_flags = 0;
750 int i, flushed; 750 int i, flushed;
751 struct ps_data *ps; 751 struct ps_data *ps;
752 struct cfg80211_chan_def chandef;
752 753
753 clear_bit(SDATA_STATE_RUNNING, &sdata->state); 754 clear_bit(SDATA_STATE_RUNNING, &sdata->state);
754 755
@@ -823,11 +824,13 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
823 cancel_delayed_work_sync(&sdata->dfs_cac_timer_work); 824 cancel_delayed_work_sync(&sdata->dfs_cac_timer_work);
824 825
825 if (sdata->wdev.cac_started) { 826 if (sdata->wdev.cac_started) {
827 chandef = sdata->vif.bss_conf.chandef;
826 WARN_ON(local->suspended); 828 WARN_ON(local->suspended);
827 mutex_lock(&local->iflist_mtx); 829 mutex_lock(&local->iflist_mtx);
828 ieee80211_vif_release_channel(sdata); 830 ieee80211_vif_release_channel(sdata);
829 mutex_unlock(&local->iflist_mtx); 831 mutex_unlock(&local->iflist_mtx);
830 cfg80211_cac_event(sdata->dev, NL80211_RADAR_CAC_ABORTED, 832 cfg80211_cac_event(sdata->dev, &chandef,
833 NL80211_RADAR_CAC_ABORTED,
831 GFP_KERNEL); 834 GFP_KERNEL);
832 } 835 }
833 836
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index eb660310ea7c..d39d27feb594 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1398,10 +1398,12 @@ void ieee80211_dfs_cac_timer_work(struct work_struct *work)
1398 struct ieee80211_sub_if_data *sdata = 1398 struct ieee80211_sub_if_data *sdata =
1399 container_of(delayed_work, struct ieee80211_sub_if_data, 1399 container_of(delayed_work, struct ieee80211_sub_if_data,
1400 dfs_cac_timer_work); 1400 dfs_cac_timer_work);
1401 struct cfg80211_chan_def chandef = sdata->vif.bss_conf.chandef;
1401 1402
1402 ieee80211_vif_release_channel(sdata); 1403 ieee80211_vif_release_channel(sdata);
1403 1404 cfg80211_cac_event(sdata->dev, &chandef,
1404 cfg80211_cac_event(sdata->dev, NL80211_RADAR_CAC_FINISHED, GFP_KERNEL); 1405 NL80211_RADAR_CAC_FINISHED,
1406 GFP_KERNEL);
1405} 1407}
1406 1408
1407/* MLME */ 1409/* MLME */
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 592a18171f95..fd4fe5d61782 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -2259,14 +2259,17 @@ u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local,
2259void ieee80211_dfs_cac_cancel(struct ieee80211_local *local) 2259void ieee80211_dfs_cac_cancel(struct ieee80211_local *local)
2260{ 2260{
2261 struct ieee80211_sub_if_data *sdata; 2261 struct ieee80211_sub_if_data *sdata;
2262 struct cfg80211_chan_def chandef;
2262 2263
2263 mutex_lock(&local->iflist_mtx); 2264 mutex_lock(&local->iflist_mtx);
2264 list_for_each_entry(sdata, &local->interfaces, list) { 2265 list_for_each_entry(sdata, &local->interfaces, list) {
2265 cancel_delayed_work_sync(&sdata->dfs_cac_timer_work); 2266 cancel_delayed_work_sync(&sdata->dfs_cac_timer_work);
2266 2267
2267 if (sdata->wdev.cac_started) { 2268 if (sdata->wdev.cac_started) {
2269 chandef = sdata->vif.bss_conf.chandef;
2268 ieee80211_vif_release_channel(sdata); 2270 ieee80211_vif_release_channel(sdata);
2269 cfg80211_cac_event(sdata->dev, 2271 cfg80211_cac_event(sdata->dev,
2272 &chandef,
2270 NL80211_RADAR_CAC_ABORTED, 2273 NL80211_RADAR_CAC_ABORTED,
2271 GFP_KERNEL); 2274 GFP_KERNEL);
2272 } 2275 }
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index 6a6b1c8e907d..31f541f7e4ea 100644
--- a/net/wireless/mlme.c
+++ b/net/wireless/mlme.c
@@ -763,12 +763,12 @@ void cfg80211_radar_event(struct wiphy *wiphy,
763EXPORT_SYMBOL(cfg80211_radar_event); 763EXPORT_SYMBOL(cfg80211_radar_event);
764 764
765void cfg80211_cac_event(struct net_device *netdev, 765void cfg80211_cac_event(struct net_device *netdev,
766 const struct cfg80211_chan_def *chandef,
766 enum nl80211_radar_event event, gfp_t gfp) 767 enum nl80211_radar_event event, gfp_t gfp)
767{ 768{
768 struct wireless_dev *wdev = netdev->ieee80211_ptr; 769 struct wireless_dev *wdev = netdev->ieee80211_ptr;
769 struct wiphy *wiphy = wdev->wiphy; 770 struct wiphy *wiphy = wdev->wiphy;
770 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); 771 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
771 struct cfg80211_chan_def chandef;
772 unsigned long timeout; 772 unsigned long timeout;
773 773
774 trace_cfg80211_cac_event(netdev, event); 774 trace_cfg80211_cac_event(netdev, event);
@@ -779,14 +779,12 @@ void cfg80211_cac_event(struct net_device *netdev,
779 if (WARN_ON(!wdev->channel)) 779 if (WARN_ON(!wdev->channel))
780 return; 780 return;
781 781
782 cfg80211_chandef_create(&chandef, wdev->channel, NL80211_CHAN_NO_HT);
783
784 switch (event) { 782 switch (event) {
785 case NL80211_RADAR_CAC_FINISHED: 783 case NL80211_RADAR_CAC_FINISHED:
786 timeout = wdev->cac_start_time + 784 timeout = wdev->cac_start_time +
787 msecs_to_jiffies(IEEE80211_DFS_MIN_CAC_TIME_MS); 785 msecs_to_jiffies(IEEE80211_DFS_MIN_CAC_TIME_MS);
788 WARN_ON(!time_after_eq(jiffies, timeout)); 786 WARN_ON(!time_after_eq(jiffies, timeout));
789 cfg80211_set_dfs_state(wiphy, &chandef, NL80211_DFS_AVAILABLE); 787 cfg80211_set_dfs_state(wiphy, chandef, NL80211_DFS_AVAILABLE);
790 break; 788 break;
791 case NL80211_RADAR_CAC_ABORTED: 789 case NL80211_RADAR_CAC_ABORTED:
792 break; 790 break;
@@ -796,6 +794,6 @@ void cfg80211_cac_event(struct net_device *netdev,
796 } 794 }
797 wdev->cac_started = false; 795 wdev->cac_started = false;
798 796
799 nl80211_radar_notify(rdev, &chandef, event, netdev, gfp); 797 nl80211_radar_notify(rdev, chandef, event, netdev, gfp);
800} 798}
801EXPORT_SYMBOL(cfg80211_cac_event); 799EXPORT_SYMBOL(cfg80211_cac_event);
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 1ad11de6dd2f..04fa8bb1b4bb 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -2168,7 +2168,7 @@ static inline u64 wdev_id(struct wireless_dev *wdev)
2168} 2168}
2169 2169
2170static int nl80211_send_chandef(struct sk_buff *msg, 2170static int nl80211_send_chandef(struct sk_buff *msg,
2171 struct cfg80211_chan_def *chandef) 2171 const struct cfg80211_chan_def *chandef)
2172{ 2172{
2173 WARN_ON(!cfg80211_chandef_valid(chandef)); 2173 WARN_ON(!cfg80211_chandef_valid(chandef));
2174 2174
@@ -10874,7 +10874,7 @@ EXPORT_SYMBOL(cfg80211_cqm_txe_notify);
10874 10874
10875void 10875void
10876nl80211_radar_notify(struct cfg80211_registered_device *rdev, 10876nl80211_radar_notify(struct cfg80211_registered_device *rdev,
10877 struct cfg80211_chan_def *chandef, 10877 const struct cfg80211_chan_def *chandef,
10878 enum nl80211_radar_event event, 10878 enum nl80211_radar_event event,
10879 struct net_device *netdev, gfp_t gfp) 10879 struct net_device *netdev, gfp_t gfp)
10880{ 10880{
diff --git a/net/wireless/nl80211.h b/net/wireless/nl80211.h
index 2c0f2b3c07cb..b1b231324e10 100644
--- a/net/wireless/nl80211.h
+++ b/net/wireless/nl80211.h
@@ -70,7 +70,7 @@ int nl80211_send_mgmt(struct cfg80211_registered_device *rdev,
70 70
71void 71void
72nl80211_radar_notify(struct cfg80211_registered_device *rdev, 72nl80211_radar_notify(struct cfg80211_registered_device *rdev,
73 struct cfg80211_chan_def *chandef, 73 const struct cfg80211_chan_def *chandef,
74 enum nl80211_radar_event event, 74 enum nl80211_radar_event event,
75 struct net_device *netdev, gfp_t gfp); 75 struct net_device *netdev, gfp_t gfp);
76 76