Commit bba05e3d authored by Janusz Dziedzic's avatar Janusz Dziedzic Committed by Johannes Berg

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: default avatarJanusz Dziedzic <janusz.dziedzic@tieto.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 70526e54
...@@ -1889,6 +1889,17 @@ static int hwsim_fops_ps_write(void *dat, u64 val) ...@@ -1889,6 +1889,17 @@ static int hwsim_fops_ps_write(void *dat, u64 val)
DEFINE_SIMPLE_ATTRIBUTE(hwsim_fops_ps, hwsim_fops_ps_read, hwsim_fops_ps_write, DEFINE_SIMPLE_ATTRIBUTE(hwsim_fops_ps, hwsim_fops_ps_read, hwsim_fops_ps_write,
"%llu\n"); "%llu\n");
static int hwsim_write_simulate_radar(void *dat, u64 val)
{
struct mac80211_hwsim_data *data = dat;
ieee80211_radar_detected(data->hw);
return 0;
}
DEFINE_SIMPLE_ATTRIBUTE(hwsim_simulate_radar, NULL,
hwsim_write_simulate_radar, "%llu\n");
static int hwsim_fops_group_read(void *dat, u64 *val) static int hwsim_fops_group_read(void *dat, u64 *val)
{ {
...@@ -2190,11 +2201,28 @@ static const struct ieee80211_iface_limit hwsim_if_limits[] = { ...@@ -2190,11 +2201,28 @@ static const struct ieee80211_iface_limit hwsim_if_limits[] = {
{ .max = 1, .types = BIT(NL80211_IFTYPE_P2P_DEVICE) }, { .max = 1, .types = BIT(NL80211_IFTYPE_P2P_DEVICE) },
}; };
static struct ieee80211_iface_combination hwsim_if_comb = { static const struct ieee80211_iface_limit hwsim_if_dfs_limits[] = {
.limits = hwsim_if_limits, { .max = 8, .types = BIT(NL80211_IFTYPE_AP) },
.n_limits = ARRAY_SIZE(hwsim_if_limits), };
.max_interfaces = 2048,
.num_different_channels = 1, static struct ieee80211_iface_combination hwsim_if_comb[] = {
{
.limits = hwsim_if_limits,
.n_limits = ARRAY_SIZE(hwsim_if_limits),
.max_interfaces = 2048,
.num_different_channels = 1,
},
{
.limits = hwsim_if_dfs_limits,
.n_limits = ARRAY_SIZE(hwsim_if_dfs_limits),
.max_interfaces = 8,
.num_different_channels = 1,
.radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |
BIT(NL80211_CHAN_WIDTH_20) |
BIT(NL80211_CHAN_WIDTH_40) |
BIT(NL80211_CHAN_WIDTH_80) |
BIT(NL80211_CHAN_WIDTH_160),
}
}; };
static int __init init_mac80211_hwsim(void) static int __init init_mac80211_hwsim(void)
...@@ -2212,7 +2240,7 @@ static int __init init_mac80211_hwsim(void) ...@@ -2212,7 +2240,7 @@ static int __init init_mac80211_hwsim(void)
return -EINVAL; return -EINVAL;
if (channels > 1) { if (channels > 1) {
hwsim_if_comb.num_different_channels = channels; hwsim_if_comb[0].num_different_channels = channels;
mac80211_hwsim_ops.hw_scan = mac80211_hwsim_hw_scan; mac80211_hwsim_ops.hw_scan = mac80211_hwsim_hw_scan;
mac80211_hwsim_ops.cancel_hw_scan = mac80211_hwsim_ops.cancel_hw_scan =
mac80211_hwsim_cancel_hw_scan; mac80211_hwsim_cancel_hw_scan;
...@@ -2292,13 +2320,15 @@ static int __init init_mac80211_hwsim(void) ...@@ -2292,13 +2320,15 @@ static int __init init_mac80211_hwsim(void)
hw->wiphy->n_addresses = 2; hw->wiphy->n_addresses = 2;
hw->wiphy->addresses = data->addresses; hw->wiphy->addresses = data->addresses;
hw->wiphy->iface_combinations = &hwsim_if_comb; hw->wiphy->iface_combinations = hwsim_if_comb;
hw->wiphy->n_iface_combinations = 1; hw->wiphy->n_iface_combinations = ARRAY_SIZE(hwsim_if_comb);
if (channels > 1) { if (channels > 1) {
hw->wiphy->max_scan_ssids = 255; hw->wiphy->max_scan_ssids = 255;
hw->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN; hw->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN;
hw->wiphy->max_remain_on_channel_duration = 1000; hw->wiphy->max_remain_on_channel_duration = 1000;
/* For channels > 1 DFS is not allowed */
hw->wiphy->n_iface_combinations = 1;
} }
INIT_DELAYED_WORK(&data->roc_done, hw_roc_done); INIT_DELAYED_WORK(&data->roc_done, hw_roc_done);
...@@ -2534,6 +2564,10 @@ static int __init init_mac80211_hwsim(void) ...@@ -2534,6 +2564,10 @@ static int __init init_mac80211_hwsim(void)
&hwsim_fops_ps); &hwsim_fops_ps);
debugfs_create_file("group", 0666, data->debugfs, data, debugfs_create_file("group", 0666, data->debugfs, data,
&hwsim_fops_group); &hwsim_fops_group);
if (channels == 1)
debugfs_create_file("dfs_simulate_radar", 0222,
data->debugfs,
data, &hwsim_simulate_radar);
tasklet_hrtimer_init(&data->beacon_timer, tasklet_hrtimer_init(&data->beacon_timer,
mac80211_hwsim_beacon, mac80211_hwsim_beacon,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment