linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] wlcore: don't WARN_ON in case of existing ROC
@ 2016-03-06 17:15 Eliad Peller
  2016-03-06 17:15 ` [PATCH 2/2] wlcore/wl18xx: add radar_debug_mode handling Eliad Peller
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Eliad Peller @ 2016-03-06 17:15 UTC (permalink / raw)
  To: linux-wireless

When working with AP + P2P, it's possible to get into
a state when the AP is in ROC (due to assiciating station)
while trying to ROC on the P2P interface.

Replace the WARN_ON with wl1271_error to avoid warnings
in this case.

Signed-off-by: Eliad Peller <eliad@wizery.com>
---
 drivers/net/wireless/ti/wlcore/main.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
index d1109c4..cb2e8b6 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -5506,9 +5506,10 @@ static int wlcore_op_remain_on_channel(struct ieee80211_hw *hw,
 		goto out;
 
 	/* return EBUSY if we can't ROC right now */
-	if (WARN_ON(wl->roc_vif ||
-		    find_first_bit(wl->roc_map,
-				   WL12XX_MAX_ROLES) < WL12XX_MAX_ROLES)) {
+	if (wl->roc_vif ||
+	    find_first_bit(wl->roc_map, WL12XX_MAX_ROLES) < WL12XX_MAX_ROLES) {
+		wl1271_warning("active roc on role %d",
+			       find_first_bit(wl->roc_map, WL12XX_MAX_ROLES));
 		ret = -EBUSY;
 		goto out;
 	}
-- 
2.6.3


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

* [PATCH 2/2] wlcore/wl18xx: add radar_debug_mode handling
  2016-03-06 17:15 [PATCH 1/2] wlcore: don't WARN_ON in case of existing ROC Eliad Peller
@ 2016-03-06 17:15 ` Eliad Peller
  2016-03-06 17:33 ` [PATCH 1/2] wlcore: don't WARN_ON in case of existing ROC kbuild test robot
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Eliad Peller @ 2016-03-06 17:15 UTC (permalink / raw)
  To: linux-wireless

Add debugfs key (under CFG80211_CERTIFICATION_ONUS
configuration) to set/clear radar_debug_mode.
In this mode, the driver simply ignores radar
events (but prints them).

The fw is notified about this mode through
a special generic_cfg_feature command.

This mode is relevant only for ap mode. look for
it when initializing ap vif.

Signed-off-by: Eliad Peller <eliad@wizery.com>
---
 drivers/net/wireless/ti/wl18xx/debugfs.c | 66 ++++++++++++++++++++++++++++++++
 drivers/net/wireless/ti/wl18xx/event.c   |  3 +-
 drivers/net/wireless/ti/wlcore/init.c    |  5 +++
 drivers/net/wireless/ti/wlcore/wlcore.h  |  1 +
 4 files changed, 74 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ti/wl18xx/debugfs.c b/drivers/net/wireless/ti/wl18xx/debugfs.c
index 4edfe28..86ccf84 100644
--- a/drivers/net/wireless/ti/wl18xx/debugfs.c
+++ b/drivers/net/wireless/ti/wl18xx/debugfs.c
@@ -345,6 +345,69 @@ static const struct file_operations dynamic_fw_traces_ops = {
 	.llseek = default_llseek,
 };
 
+#ifdef CONFIG_CFG80211_CERTIFICATION_ONUS
+static ssize_t radar_debug_mode_write(struct file *file,
+				      const char __user *user_buf,
+				      size_t count, loff_t *ppos)
+{
+	struct wl1271 *wl = file->private_data;
+	struct wl12xx_vif *wlvif;
+	unsigned long value;
+	int ret;
+
+	ret = kstrtoul_from_user(user_buf, count, 10, &value);
+	if (ret < 0) {
+		wl1271_warning("illegal radar_debug_mode value!");
+		return -EINVAL;
+	}
+
+	/* valid values: 0/1 */
+	if (!(value == 0 || value == 1)) {
+		wl1271_warning("value is not in valid!");
+		return -EINVAL;
+	}
+
+	mutex_lock(&wl->mutex);
+
+	wl->radar_debug_mode = value;
+
+	if (unlikely(wl->state != WLCORE_STATE_ON))
+		goto out;
+
+	ret = wl1271_ps_elp_wakeup(wl);
+	if (ret < 0)
+		goto out;
+
+	wl12xx_for_each_wlvif_ap(wl, wlvif) {
+		wlcore_cmd_generic_cfg(wl, wlvif,
+				       WLCORE_CFG_FEATURE_RADAR_DEBUG,
+				       wl->radar_debug_mode, 0);
+	}
+
+	wl1271_ps_elp_sleep(wl);
+out:
+	mutex_unlock(&wl->mutex);
+	return count;
+}
+
+static ssize_t radar_debug_mode_read(struct file *file,
+				     char __user *userbuf,
+				     size_t count, loff_t *ppos)
+{
+	struct wl1271 *wl = file->private_data;
+
+	return wl1271_format_buffer(userbuf, count, ppos,
+				    "%d\n", wl->radar_debug_mode);
+}
+
+static const struct file_operations radar_debug_mode_ops = {
+	.write = radar_debug_mode_write,
+	.read = radar_debug_mode_read,
+	.open = simple_open,
+	.llseek = default_llseek,
+};
+#endif /* CFG80211_CERTIFICATION_ONUS */
+
 int wl18xx_debugfs_add_files(struct wl1271 *wl,
 			     struct dentry *rootdir)
 {
@@ -510,6 +573,9 @@ int wl18xx_debugfs_add_files(struct wl1271 *wl,
 
 	DEBUGFS_ADD(conf, moddir);
 	DEBUGFS_ADD(radar_detection, moddir);
+#ifdef CONFIG_CFG80211_CERTIFICATION_ONUS
+	DEBUGFS_ADD(radar_debug_mode, moddir);
+#endif
 	DEBUGFS_ADD(dynamic_fw_traces, moddir);
 
 	return 0;
diff --git a/drivers/net/wireless/ti/wl18xx/event.c b/drivers/net/wireless/ti/wl18xx/event.c
index 719907a..ff6e46d 100644
--- a/drivers/net/wireless/ti/wl18xx/event.c
+++ b/drivers/net/wireless/ti/wl18xx/event.c
@@ -146,7 +146,8 @@ int wl18xx_process_mailbox_events(struct wl1271 *wl)
 			    mbox->radar_channel,
 			    wl18xx_radar_type_decode(mbox->radar_type));
 
-		ieee80211_radar_detected(wl->hw);
+		if (!wl->radar_debug_mode)
+			ieee80211_radar_detected(wl->hw);
 	}
 
 	if (vector & PERIODIC_SCAN_REPORT_EVENT_ID) {
diff --git a/drivers/net/wireless/ti/wlcore/init.c b/drivers/net/wireless/ti/wlcore/init.c
index e92f263..d0b7734 100644
--- a/drivers/net/wireless/ti/wlcore/init.c
+++ b/drivers/net/wireless/ti/wlcore/init.c
@@ -558,6 +558,11 @@ static int wl12xx_init_ap_role(struct wl1271 *wl, struct wl12xx_vif *wlvif)
 	if (ret < 0)
 		return ret;
 
+	if (wl->radar_debug_mode)
+		wlcore_cmd_generic_cfg(wl, wlvif,
+				       WLCORE_CFG_FEATURE_RADAR_DEBUG,
+				       wl->radar_debug_mode, 0);
+
 	return 0;
 }
 
diff --git a/drivers/net/wireless/ti/wlcore/wlcore.h b/drivers/net/wireless/ti/wlcore/wlcore.h
index dda01b1..72c31a8 100644
--- a/drivers/net/wireless/ti/wlcore/wlcore.h
+++ b/drivers/net/wireless/ti/wlcore/wlcore.h
@@ -463,6 +463,7 @@ struct wl1271 {
 
 	/* the current dfs region */
 	enum nl80211_dfs_regions dfs_region;
+	bool radar_debug_mode;
 
 	/* size of the private FW status data */
 	size_t fw_status_len;
-- 
2.6.3


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

* Re: [PATCH 1/2] wlcore: don't WARN_ON in case of existing ROC
  2016-03-06 17:15 [PATCH 1/2] wlcore: don't WARN_ON in case of existing ROC Eliad Peller
  2016-03-06 17:15 ` [PATCH 2/2] wlcore/wl18xx: add radar_debug_mode handling Eliad Peller
@ 2016-03-06 17:33 ` kbuild test robot
  2016-03-06 17:47 ` kbuild test robot
  2016-03-06 19:32 ` kbuild test robot
  3 siblings, 0 replies; 5+ messages in thread
From: kbuild test robot @ 2016-03-06 17:33 UTC (permalink / raw)
  To: Eliad Peller; +Cc: kbuild-all, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 2089 bytes --]

Hi Eliad,

[auto build test WARNING on wireless-drivers-next/master]
[also build test WARNING on v4.5-rc6 next-20160304]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Eliad-Peller/wlcore-don-t-WARN_ON-in-case-of-existing-ROC/20160307-011744
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git master
config: sparc64-allyesconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=sparc64 

All warnings (new ones prefixed by >>):

   drivers/net/wireless/ti/wlcore/main.c: In function 'wlcore_op_remain_on_channel':
>> drivers/net/wireless/ti/wlcore/main.c:5513:3: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long unsigned int' [-Wformat=]
      wl1271_warning("active roc on role %d",
      ^

vim +5513 drivers/net/wireless/ti/wlcore/main.c

  5497		struct wl1271 *wl = hw->priv;
  5498		int channel, ret = 0;
  5499	
  5500		channel = ieee80211_frequency_to_channel(chan->center_freq);
  5501	
  5502		wl1271_debug(DEBUG_MAC80211, "mac80211 roc %d (%d)",
  5503			     channel, wlvif->role_id);
  5504	
  5505		mutex_lock(&wl->mutex);
  5506	
  5507		if (unlikely(wl->state != WLCORE_STATE_ON))
  5508			goto out;
  5509	
  5510		/* return EBUSY if we can't ROC right now */
  5511		if (wl->roc_vif ||
  5512		    find_first_bit(wl->roc_map, WL12XX_MAX_ROLES) < WL12XX_MAX_ROLES) {
> 5513			wl1271_warning("active roc on role %d",
  5514				       find_first_bit(wl->roc_map, WL12XX_MAX_ROLES));
  5515			ret = -EBUSY;
  5516			goto out;
  5517		}
  5518	
  5519		ret = wl1271_ps_elp_wakeup(wl);
  5520		if (ret < 0)
  5521			goto out;

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 45167 bytes --]

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

* Re: [PATCH 1/2] wlcore: don't WARN_ON in case of existing ROC
  2016-03-06 17:15 [PATCH 1/2] wlcore: don't WARN_ON in case of existing ROC Eliad Peller
  2016-03-06 17:15 ` [PATCH 2/2] wlcore/wl18xx: add radar_debug_mode handling Eliad Peller
  2016-03-06 17:33 ` [PATCH 1/2] wlcore: don't WARN_ON in case of existing ROC kbuild test robot
@ 2016-03-06 17:47 ` kbuild test robot
  2016-03-06 19:32 ` kbuild test robot
  3 siblings, 0 replies; 5+ messages in thread
From: kbuild test robot @ 2016-03-06 17:47 UTC (permalink / raw)
  To: Eliad Peller; +Cc: kbuild-all, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 2972 bytes --]

Hi Eliad,

[auto build test WARNING on wireless-drivers-next/master]
[also build test WARNING on v4.5-rc6 next-20160304]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Eliad-Peller/wlcore-don-t-WARN_ON-in-case-of-existing-ROC/20160307-011744
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git master
config: i386-randconfig-x002-201610 (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from include/linux/printk.h:6:0,
                    from include/linux/kernel.h:13,
                    from include/linux/list.h:8,
                    from include/linux/module.h:9,
                    from drivers/net/wireless/ti/wlcore/main.c:23:
   drivers/net/wireless/ti/wlcore/main.c: In function 'wlcore_op_remain_on_channel':
>> include/linux/kern_levels.h:4:18: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long unsigned int' [-Wformat=]
    #define KERN_SOH "\001"  /* ASCII Start Of Header */
                     ^
   include/linux/kern_levels.h:11:22: note: in expansion of macro 'KERN_SOH'
    #define KERN_WARNING KERN_SOH "4" /* warning conditions */
                         ^
>> include/linux/printk.h:254:9: note: in expansion of macro 'KERN_WARNING'
     printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
            ^
>> include/linux/printk.h:255:17: note: in expansion of macro 'pr_warning'
    #define pr_warn pr_warning
                    ^
>> drivers/net/wireless/ti/wlcore/debug.h:68:2: note: in expansion of macro 'pr_warn'
     pr_warn(DRIVER_PREFIX "WARNING " fmt "\n", ##arg)
     ^
>> drivers/net/wireless/ti/wlcore/main.c:5513:3: note: in expansion of macro 'wl1271_warning'
      wl1271_warning("active roc on role %d",
      ^

vim +/wl1271_warning +5513 drivers/net/wireless/ti/wlcore/main.c

  5497		struct wl1271 *wl = hw->priv;
  5498		int channel, ret = 0;
  5499	
  5500		channel = ieee80211_frequency_to_channel(chan->center_freq);
  5501	
  5502		wl1271_debug(DEBUG_MAC80211, "mac80211 roc %d (%d)",
  5503			     channel, wlvif->role_id);
  5504	
  5505		mutex_lock(&wl->mutex);
  5506	
  5507		if (unlikely(wl->state != WLCORE_STATE_ON))
  5508			goto out;
  5509	
  5510		/* return EBUSY if we can't ROC right now */
  5511		if (wl->roc_vif ||
  5512		    find_first_bit(wl->roc_map, WL12XX_MAX_ROLES) < WL12XX_MAX_ROLES) {
> 5513			wl1271_warning("active roc on role %d",
  5514				       find_first_bit(wl->roc_map, WL12XX_MAX_ROLES));
  5515			ret = -EBUSY;
  5516			goto out;
  5517		}
  5518	
  5519		ret = wl1271_ps_elp_wakeup(wl);
  5520		if (ret < 0)
  5521			goto out;

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 26031 bytes --]

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

* Re: [PATCH 1/2] wlcore: don't WARN_ON in case of existing ROC
  2016-03-06 17:15 [PATCH 1/2] wlcore: don't WARN_ON in case of existing ROC Eliad Peller
                   ` (2 preceding siblings ...)
  2016-03-06 17:47 ` kbuild test robot
@ 2016-03-06 19:32 ` kbuild test robot
  3 siblings, 0 replies; 5+ messages in thread
From: kbuild test robot @ 2016-03-06 19:32 UTC (permalink / raw)
  To: Eliad Peller; +Cc: kbuild-all, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 2013 bytes --]

Hi Eliad,

[auto build test WARNING on wireless-drivers-next/master]
[also build test WARNING on v4.5-rc6 next-20160304]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Eliad-Peller/wlcore-don-t-WARN_ON-in-case-of-existing-ROC/20160307-011744
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git master
config: openrisc-allmodconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=openrisc 

All warnings (new ones prefixed by >>):

   drivers/net/wireless/ti/wlcore/main.c: In function 'wlcore_op_remain_on_channel':
>> drivers/net/wireless/ti/wlcore/main.c:5513:3: warning: format '%d' expects type 'int', but argument 2 has type 'long unsigned int'

vim +5513 drivers/net/wireless/ti/wlcore/main.c

  5497		struct wl1271 *wl = hw->priv;
  5498		int channel, ret = 0;
  5499	
  5500		channel = ieee80211_frequency_to_channel(chan->center_freq);
  5501	
  5502		wl1271_debug(DEBUG_MAC80211, "mac80211 roc %d (%d)",
  5503			     channel, wlvif->role_id);
  5504	
  5505		mutex_lock(&wl->mutex);
  5506	
  5507		if (unlikely(wl->state != WLCORE_STATE_ON))
  5508			goto out;
  5509	
  5510		/* return EBUSY if we can't ROC right now */
  5511		if (wl->roc_vif ||
  5512		    find_first_bit(wl->roc_map, WL12XX_MAX_ROLES) < WL12XX_MAX_ROLES) {
> 5513			wl1271_warning("active roc on role %d",
  5514				       find_first_bit(wl->roc_map, WL12XX_MAX_ROLES));
  5515			ret = -EBUSY;
  5516			goto out;
  5517		}
  5518	
  5519		ret = wl1271_ps_elp_wakeup(wl);
  5520		if (ret < 0)
  5521			goto out;

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 36586 bytes --]

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

end of thread, other threads:[~2016-03-06 19:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-06 17:15 [PATCH 1/2] wlcore: don't WARN_ON in case of existing ROC Eliad Peller
2016-03-06 17:15 ` [PATCH 2/2] wlcore/wl18xx: add radar_debug_mode handling Eliad Peller
2016-03-06 17:33 ` [PATCH 1/2] wlcore: don't WARN_ON in case of existing ROC kbuild test robot
2016-03-06 17:47 ` kbuild test robot
2016-03-06 19:32 ` kbuild test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).