diff options
author | Janusz Dziedzic <janusz.dziedzic@tieto.com> | 2013-11-05 07:03:53 -0500 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2013-11-25 14:49:39 -0500 |
commit | bba05e3d5afb6ed31c00068f12418a9dacb42328 (patch) | |
tree | 19f9c79bc5715def0d4ade18bf243928e3bb87a6 /drivers/net/wireless/mac80211_hwsim.c | |
parent | 70526e543c8087b7fa136fd5e6be98332d609848 (diff) |
mac80211_hwsim: Add iface comb for DFS
Add iface combination that will allow DFS
support. Add also debugfs dfs_simulate_radar
file that can be used to simulate radar event.
This could be useful for mac80211/cfg80211/
regulatory/hostap code testing without real HW.
Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'drivers/net/wireless/mac80211_hwsim.c')
-rw-r--r-- | drivers/net/wireless/mac80211_hwsim.c | 50 |
1 files changed, 42 insertions, 8 deletions
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 76b362ed76bd..bad66e3cdd12 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c | |||
@@ -1889,6 +1889,17 @@ static int hwsim_fops_ps_write(void *dat, u64 val) | |||
1889 | DEFINE_SIMPLE_ATTRIBUTE(hwsim_fops_ps, hwsim_fops_ps_read, hwsim_fops_ps_write, | 1889 | DEFINE_SIMPLE_ATTRIBUTE(hwsim_fops_ps, hwsim_fops_ps_read, hwsim_fops_ps_write, |
1890 | "%llu\n"); | 1890 | "%llu\n"); |
1891 | 1891 | ||
1892 | static int hwsim_write_simulate_radar(void *dat, u64 val) | ||
1893 | { | ||
1894 | struct mac80211_hwsim_data *data = dat; | ||
1895 | |||
1896 | ieee80211_radar_detected(data->hw); | ||
1897 | |||
1898 | return 0; | ||
1899 | } | ||
1900 | |||
1901 | DEFINE_SIMPLE_ATTRIBUTE(hwsim_simulate_radar, NULL, | ||
1902 | hwsim_write_simulate_radar, "%llu\n"); | ||
1892 | 1903 | ||
1893 | static int hwsim_fops_group_read(void *dat, u64 *val) | 1904 | static int hwsim_fops_group_read(void *dat, u64 *val) |
1894 | { | 1905 | { |
@@ -2190,11 +2201,28 @@ static const struct ieee80211_iface_limit hwsim_if_limits[] = { | |||
2190 | { .max = 1, .types = BIT(NL80211_IFTYPE_P2P_DEVICE) }, | 2201 | { .max = 1, .types = BIT(NL80211_IFTYPE_P2P_DEVICE) }, |
2191 | }; | 2202 | }; |
2192 | 2203 | ||
2193 | static struct ieee80211_iface_combination hwsim_if_comb = { | 2204 | static const struct ieee80211_iface_limit hwsim_if_dfs_limits[] = { |
2194 | .limits = hwsim_if_limits, | 2205 | { .max = 8, .types = BIT(NL80211_IFTYPE_AP) }, |
2195 | .n_limits = ARRAY_SIZE(hwsim_if_limits), | 2206 | }; |
2196 | .max_interfaces = 2048, | 2207 | |
2197 | .num_different_channels = 1, | 2208 | static struct ieee80211_iface_combination hwsim_if_comb[] = { |
2209 | { | ||
2210 | .limits = hwsim_if_limits, | ||
2211 | .n_limits = ARRAY_SIZE(hwsim_if_limits), | ||
2212 | .max_interfaces = 2048, | ||
2213 | .num_different_channels = 1, | ||
2214 | }, | ||
2215 | { | ||
2216 | .limits = hwsim_if_dfs_limits, | ||
2217 | .n_limits = ARRAY_SIZE(hwsim_if_dfs_limits), | ||
2218 | .max_interfaces = 8, | ||
2219 | .num_different_channels = 1, | ||
2220 | .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) | | ||
2221 | BIT(NL80211_CHAN_WIDTH_20) | | ||
2222 | BIT(NL80211_CHAN_WIDTH_40) | | ||
2223 | BIT(NL80211_CHAN_WIDTH_80) | | ||
2224 | BIT(NL80211_CHAN_WIDTH_160), | ||
2225 | } | ||
2198 | }; | 2226 | }; |
2199 | 2227 | ||
2200 | static int __init init_mac80211_hwsim(void) | 2228 | static int __init init_mac80211_hwsim(void) |
@@ -2212,7 +2240,7 @@ static int __init init_mac80211_hwsim(void) | |||
2212 | return -EINVAL; | 2240 | return -EINVAL; |
2213 | 2241 | ||
2214 | if (channels > 1) { | 2242 | if (channels > 1) { |
2215 | hwsim_if_comb.num_different_channels = channels; | 2243 | hwsim_if_comb[0].num_different_channels = channels; |
2216 | mac80211_hwsim_ops.hw_scan = mac80211_hwsim_hw_scan; | 2244 | mac80211_hwsim_ops.hw_scan = mac80211_hwsim_hw_scan; |
2217 | mac80211_hwsim_ops.cancel_hw_scan = | 2245 | mac80211_hwsim_ops.cancel_hw_scan = |
2218 | mac80211_hwsim_cancel_hw_scan; | 2246 | mac80211_hwsim_cancel_hw_scan; |
@@ -2292,13 +2320,15 @@ static int __init init_mac80211_hwsim(void) | |||
2292 | hw->wiphy->n_addresses = 2; | 2320 | hw->wiphy->n_addresses = 2; |
2293 | hw->wiphy->addresses = data->addresses; | 2321 | hw->wiphy->addresses = data->addresses; |
2294 | 2322 | ||
2295 | hw->wiphy->iface_combinations = &hwsim_if_comb; | 2323 | hw->wiphy->iface_combinations = hwsim_if_comb; |
2296 | hw->wiphy->n_iface_combinations = 1; | 2324 | hw->wiphy->n_iface_combinations = ARRAY_SIZE(hwsim_if_comb); |
2297 | 2325 | ||
2298 | if (channels > 1) { | 2326 | if (channels > 1) { |
2299 | hw->wiphy->max_scan_ssids = 255; | 2327 | hw->wiphy->max_scan_ssids = 255; |
2300 | hw->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN; | 2328 | hw->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN; |
2301 | hw->wiphy->max_remain_on_channel_duration = 1000; | 2329 | hw->wiphy->max_remain_on_channel_duration = 1000; |
2330 | /* For channels > 1 DFS is not allowed */ | ||
2331 | hw->wiphy->n_iface_combinations = 1; | ||
2302 | } | 2332 | } |
2303 | 2333 | ||
2304 | INIT_DELAYED_WORK(&data->roc_done, hw_roc_done); | 2334 | INIT_DELAYED_WORK(&data->roc_done, hw_roc_done); |
@@ -2534,6 +2564,10 @@ static int __init init_mac80211_hwsim(void) | |||
2534 | &hwsim_fops_ps); | 2564 | &hwsim_fops_ps); |
2535 | debugfs_create_file("group", 0666, data->debugfs, data, | 2565 | debugfs_create_file("group", 0666, data->debugfs, data, |
2536 | &hwsim_fops_group); | 2566 | &hwsim_fops_group); |
2567 | if (channels == 1) | ||
2568 | debugfs_create_file("dfs_simulate_radar", 0222, | ||
2569 | data->debugfs, | ||
2570 | data, &hwsim_simulate_radar); | ||
2537 | 2571 | ||
2538 | tasklet_hrtimer_init(&data->beacon_timer, | 2572 | tasklet_hrtimer_init(&data->beacon_timer, |
2539 | mac80211_hwsim_beacon, | 2573 | mac80211_hwsim_beacon, |