All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/3] mac80211_hwsim: use debugfs_remove_recursive
@ 2013-11-01 19:35 Janusz Dziedzic
  2013-11-01 19:35 ` [PATCH v2 2/3] mac80211_hwsim: Add iface comb for DFS Janusz Dziedzic
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Janusz Dziedzic @ 2013-11-01 19:35 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes, Janusz Dziedzic

Use debugfs_remove_recursive. That avoids the need
for the new dentry pointers and extra debugfs_remove
calls.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
 drivers/net/wireless/mac80211_hwsim.c |   16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index 1f49330..cb6b98e 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -352,7 +352,6 @@ struct mac80211_hwsim_data {
 	} ps;
 	bool ps_poll_pending;
 	struct dentry *debugfs;
-	struct dentry *debugfs_ps;
 
 	struct sk_buff_head pending;	/* packets pending */
 	/*
@@ -361,7 +360,6 @@ struct mac80211_hwsim_data {
 	 * radio can be in more then one group.
 	 */
 	u64 group;
-	struct dentry *debugfs_group;
 
 	int power_level;
 
@@ -1713,9 +1711,7 @@ static void mac80211_hwsim_free(void)
 	spin_unlock_bh(&hwsim_radio_lock);
 
 	list_for_each_entry_safe(data, tmpdata, &tmplist, list) {
-		debugfs_remove(data->debugfs_group);
-		debugfs_remove(data->debugfs_ps);
-		debugfs_remove(data->debugfs);
+		debugfs_remove_recursive(data->debugfs);
 		ieee80211_unregister_hw(data->hw);
 		device_release_driver(data->dev);
 		device_unregister(data->dev);
@@ -2511,12 +2507,10 @@ static int __init init_mac80211_hwsim(void)
 
 		data->debugfs = debugfs_create_dir("hwsim",
 						   hw->wiphy->debugfsdir);
-		data->debugfs_ps = debugfs_create_file("ps", 0666,
-						       data->debugfs, data,
-						       &hwsim_fops_ps);
-		data->debugfs_group = debugfs_create_file("group", 0666,
-							data->debugfs, data,
-							&hwsim_fops_group);
+		debugfs_create_file("ps", 0666, data->debugfs, data,
+				    &hwsim_fops_ps);
+		debugfs_create_file("group", 0666, data->debugfs, data,
+				    &hwsim_fops_group);
 
 		tasklet_hrtimer_init(&data->beacon_timer,
 				     mac80211_hwsim_beacon,
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 2/3] mac80211_hwsim: Add iface comb for DFS
  2013-11-01 19:35 [PATCH v2 1/3] mac80211_hwsim: use debugfs_remove_recursive Janusz Dziedzic
@ 2013-11-01 19:35 ` Janusz Dziedzic
  2013-11-01 19:36 ` [PATCH v2 3/3] mac80211_hwsim: VHT add 160MHz width support Janusz Dziedzic
  2013-11-04 14:14 ` [PATCH v2 1/3] mac80211_hwsim: use debugfs_remove_recursive Johannes Berg
  2 siblings, 0 replies; 5+ messages in thread
From: Janusz Dziedzic @ 2013-11-01 19:35 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes, Janusz Dziedzic

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>
---
 drivers/net/wireless/mac80211_hwsim.c |   46 +++++++++++++++++++++++++++------
 1 file changed, 38 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index cb6b98e..085d165 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -1868,6 +1868,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,
 			"%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)
 {
@@ -2169,11 +2180,28 @@ static const struct ieee80211_iface_limit hwsim_if_limits[] = {
 	{ .max = 1, .types = BIT(NL80211_IFTYPE_P2P_DEVICE) },
 };
 
-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,
+static const struct ieee80211_iface_limit hwsim_if_dfs_limits[] = {
+	{ .max = 8, .types = BIT(NL80211_IFTYPE_AP) },
+};
+
+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)
@@ -2191,7 +2219,7 @@ static int __init init_mac80211_hwsim(void)
 		return -EINVAL;
 
 	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.cancel_hw_scan =
 			mac80211_hwsim_cancel_hw_scan;
@@ -2271,8 +2299,8 @@ static int __init init_mac80211_hwsim(void)
 		hw->wiphy->n_addresses = 2;
 		hw->wiphy->addresses = data->addresses;
 
-		hw->wiphy->iface_combinations = &hwsim_if_comb;
-		hw->wiphy->n_iface_combinations = 1;
+		hw->wiphy->iface_combinations = hwsim_if_comb;
+		hw->wiphy->n_iface_combinations = ARRAY_SIZE(hwsim_if_comb);
 
 		if (channels > 1) {
 			hw->wiphy->max_scan_ssids = 255;
@@ -2511,6 +2539,8 @@ static int __init init_mac80211_hwsim(void)
 				    &hwsim_fops_ps);
 		debugfs_create_file("group", 0666, data->debugfs, data,
 				    &hwsim_fops_group);
+		debugfs_create_file("dfs_simulate_radar", 0222, data->debugfs,
+				    data, &hwsim_simulate_radar);
 
 		tasklet_hrtimer_init(&data->beacon_timer,
 				     mac80211_hwsim_beacon,
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 3/3] mac80211_hwsim: VHT add 160MHz width support
  2013-11-01 19:35 [PATCH v2 1/3] mac80211_hwsim: use debugfs_remove_recursive Janusz Dziedzic
  2013-11-01 19:35 ` [PATCH v2 2/3] mac80211_hwsim: Add iface comb for DFS Janusz Dziedzic
@ 2013-11-01 19:36 ` Janusz Dziedzic
  2013-11-04 14:14 ` [PATCH v2 1/3] mac80211_hwsim: use debugfs_remove_recursive Johannes Berg
  2 siblings, 0 replies; 5+ messages in thread
From: Janusz Dziedzic @ 2013-11-01 19:36 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes, Janusz Dziedzic

Add 160MHz width support. This could be
usefull for testing VHT160 and DFS functionality.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
 drivers/net/wireless/mac80211_hwsim.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index 085d165..1d4e3e3 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -2387,6 +2387,7 @@ static int __init init_mac80211_hwsim(void)
 			sband->vht_cap.cap =
 				IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 |
 				IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ |
+				IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ |
 				IEEE80211_VHT_CAP_RXLDPC |
 				IEEE80211_VHT_CAP_SHORT_GI_80 |
 				IEEE80211_VHT_CAP_SHORT_GI_160 |
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/3] mac80211_hwsim: use debugfs_remove_recursive
  2013-11-01 19:35 [PATCH v2 1/3] mac80211_hwsim: use debugfs_remove_recursive Janusz Dziedzic
  2013-11-01 19:35 ` [PATCH v2 2/3] mac80211_hwsim: Add iface comb for DFS Janusz Dziedzic
  2013-11-01 19:36 ` [PATCH v2 3/3] mac80211_hwsim: VHT add 160MHz width support Janusz Dziedzic
@ 2013-11-04 14:14 ` Johannes Berg
  2013-11-05 10:14   ` Johannes Berg
  2 siblings, 1 reply; 5+ messages in thread
From: Johannes Berg @ 2013-11-04 14:14 UTC (permalink / raw)
  To: Janusz Dziedzic; +Cc: linux-wireless

On Fri, 2013-11-01 at 20:35 +0100, Janusz Dziedzic wrote:
> Use debugfs_remove_recursive. That avoids the need
> for the new dentry pointers and extra debugfs_remove
> calls.

All applied, thanks.

johannes


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/3] mac80211_hwsim: use debugfs_remove_recursive
  2013-11-04 14:14 ` [PATCH v2 1/3] mac80211_hwsim: use debugfs_remove_recursive Johannes Berg
@ 2013-11-05 10:14   ` Johannes Berg
  0 siblings, 0 replies; 5+ messages in thread
From: Johannes Berg @ 2013-11-05 10:14 UTC (permalink / raw)
  To: Janusz Dziedzic; +Cc: linux-wireless

On Mon, 2013-11-04 at 15:14 +0100, Johannes Berg wrote:
> On Fri, 2013-11-01 at 20:35 +0100, Janusz Dziedzic wrote:
> > Use debugfs_remove_recursive. That avoids the need
> > for the new dentry pointers and extra debugfs_remove
> > calls.
> 
> All applied, thanks.

Actually, I dropped patches 2 and 3 again - they're causing issues with
channels>1 since DFS isn't allowed then. That in turn exposes a bug in
hwsim with registration failures causing warnings or even crashes
(depending on the kernel version).

johannes


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-11-05 10:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-01 19:35 [PATCH v2 1/3] mac80211_hwsim: use debugfs_remove_recursive Janusz Dziedzic
2013-11-01 19:35 ` [PATCH v2 2/3] mac80211_hwsim: Add iface comb for DFS Janusz Dziedzic
2013-11-01 19:36 ` [PATCH v2 3/3] mac80211_hwsim: VHT add 160MHz width support Janusz Dziedzic
2013-11-04 14:14 ` [PATCH v2 1/3] mac80211_hwsim: use debugfs_remove_recursive Johannes Berg
2013-11-05 10:14   ` Johannes Berg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.