linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] nl80211: add flag to force passive scan on DFS channels
@ 2015-11-13 17:56 Antonio Quartulli
  2015-11-13 17:56 ` [PATCH 2/2] mac80211: passively scan DFS channels if requested Antonio Quartulli
  0 siblings, 1 reply; 4+ messages in thread
From: Antonio Quartulli @ 2015-11-13 17:56 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, Antonio Quartulli, Antonio Quartulli

In certain circumstances the user might not want to actively
scan DFS channels, therefore add a nl80211 scan flag to
instruct the underlying layers that DFS channels must be
passively scanned.

This flag can be specified upon scan trigger command.

Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
---
 include/uapi/linux/nl80211.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 1f0b4cf..2083e53 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -4456,12 +4456,14 @@ enum nl80211_connect_failed_reason {
  *	locally administered 1, multicast 0) is assumed.
  *	This flag must not be requested when the feature isn't supported, check
  *	the nl80211 feature flags for the device.
+ * @NL80211_SCAN_FLAG_PASSIVE_RADAR: force passive scan on DFS channels
  */
 enum nl80211_scan_flags {
 	NL80211_SCAN_FLAG_LOW_PRIORITY			= 1<<0,
 	NL80211_SCAN_FLAG_FLUSH				= 1<<1,
 	NL80211_SCAN_FLAG_AP				= 1<<2,
 	NL80211_SCAN_FLAG_RANDOM_ADDR			= 1<<3,
+	NL80211_SCAN_FLAG_PASSIVE_RADAR			= 1<<4,
 };
 
 /**
-- 
2.6.3


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

* [PATCH 2/2] mac80211: passively scan DFS channels if requested
  2015-11-13 17:56 [PATCH 1/2] nl80211: add flag to force passive scan on DFS channels Antonio Quartulli
@ 2015-11-13 17:56 ` Antonio Quartulli
  2015-11-13 19:19   ` kbuild test robot
  2015-11-13 20:19   ` kbuild test robot
  0 siblings, 2 replies; 4+ messages in thread
From: Antonio Quartulli @ 2015-11-13 17:56 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, Antonio Quartulli, Antonio Quartulli

if the NL80211_SCAN_FLAG_PASSIVE_RADAR flag was specified upon
sw scan start, passively scan any channel marked as DFS.

Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
---
 net/mac80211/scan.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index 4aeca4b..d8f7b4a 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -599,7 +599,9 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata,
 
 		if ((req->channels[0]->flags &
 		     IEEE80211_CHAN_NO_IR) ||
-		    !req->n_ssids) {
+		    !req->n_ssids ||
+		    ((chan->flags & IEEE80211_CHAN_RADAR) &&
+		     (scan_req->flags & NL80211_SCAN_FLAG_PASSIVE_RADAR))) {
 			next_delay = IEEE80211_PASSIVE_CHANNEL_TIME;
 		} else {
 			ieee80211_scan_state_send_probe(local, &next_delay);
@@ -645,7 +647,9 @@ ieee80211_scan_get_channel_time(struct ieee80211_channel *chan)
 	 * TODO: channel switching also consumes quite some time,
 	 * add that delay as well to get a better estimation
 	 */
-	if (chan->flags & IEEE80211_CHAN_NO_IR)
+	if ((chan->flags & IEEE80211_CHAN_NO_IR) ||
+	    ((chan->flags & IEEE80211_CHAN_RADAR) &&
+	     (scan_req->flags & NL80211_SCAN_FLAG_PASSIVE_RADAR)))
 		return IEEE80211_PASSIVE_CHANNEL_TIME;
 	return IEEE80211_PROBE_DELAY + IEEE80211_CHANNEL_TIME;
 }
@@ -777,7 +781,9 @@ static void ieee80211_scan_state_set_channel(struct ieee80211_local *local,
 	 *
 	 * In any case, it is not necessary for a passive scan.
 	 */
-	if (chan->flags & IEEE80211_CHAN_NO_IR || !scan_req->n_ssids) {
+	if (chan->flags & IEEE80211_CHAN_NO_IR || !scan_req->n_ssids ||
+	    ((chan->flags & IEEE80211_CHAN_RADAR) &&
+	     (scan_req->flags & NL80211_SCAN_FLAG_PASSIVE_RADAR))) {
 		*next_delay = IEEE80211_PASSIVE_CHANNEL_TIME;
 		local->next_scan_state = SCAN_DECISION;
 		return;
-- 
2.6.3


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

* Re: [PATCH 2/2] mac80211: passively scan DFS channels if requested
  2015-11-13 17:56 ` [PATCH 2/2] mac80211: passively scan DFS channels if requested Antonio Quartulli
@ 2015-11-13 19:19   ` kbuild test robot
  2015-11-13 20:19   ` kbuild test robot
  1 sibling, 0 replies; 4+ messages in thread
From: kbuild test robot @ 2015-11-13 19:19 UTC (permalink / raw)
  To: Antonio Quartulli
  Cc: kbuild-all, Johannes Berg, linux-wireless, Antonio Quartulli,
	Antonio Quartulli

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

Hi Antonio,

[auto build test ERROR on: mac80211-next/master]
[also build test ERROR on: v4.3 next-20151113]

url:    https://github.com/0day-ci/linux/commits/Antonio-Quartulli/nl80211-add-flag-to-force-passive-scan-on-DFS-channels/20151114-025331
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master
config: i386-defconfig (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   net/mac80211/scan.c: In function '__ieee80211_start_scan':
>> net/mac80211/scan.c:603:9: error: 'chan' undeclared (first use in this function)
          ((chan->flags & IEEE80211_CHAN_RADAR) &&
            ^
   net/mac80211/scan.c:603:9: note: each undeclared identifier is reported only once for each function it appears in
>> net/mac80211/scan.c:604:9: error: 'scan_req' undeclared (first use in this function)
           (scan_req->flags & NL80211_SCAN_FLAG_PASSIVE_RADAR))) {
            ^
   net/mac80211/scan.c: In function 'ieee80211_scan_get_channel_time':
   net/mac80211/scan.c:652:8: error: 'scan_req' undeclared (first use in this function)
          (scan_req->flags & NL80211_SCAN_FLAG_PASSIVE_RADAR)))
           ^

vim +/chan +603 net/mac80211/scan.c

   597			/* We need to ensure power level is at max for scanning. */
   598			ieee80211_hw_config(local, 0);
   599	
   600			if ((req->channels[0]->flags &
   601			     IEEE80211_CHAN_NO_IR) ||
   602			    !req->n_ssids ||
 > 603			    ((chan->flags & IEEE80211_CHAN_RADAR) &&
 > 604			     (scan_req->flags & NL80211_SCAN_FLAG_PASSIVE_RADAR))) {
   605				next_delay = IEEE80211_PASSIVE_CHANNEL_TIME;
   606			} else {
   607				ieee80211_scan_state_send_probe(local, &next_delay);

---
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: 23825 bytes --]

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

* Re: [PATCH 2/2] mac80211: passively scan DFS channels if requested
  2015-11-13 17:56 ` [PATCH 2/2] mac80211: passively scan DFS channels if requested Antonio Quartulli
  2015-11-13 19:19   ` kbuild test robot
@ 2015-11-13 20:19   ` kbuild test robot
  1 sibling, 0 replies; 4+ messages in thread
From: kbuild test robot @ 2015-11-13 20:19 UTC (permalink / raw)
  To: Antonio Quartulli
  Cc: kbuild-all, Johannes Berg, linux-wireless, Antonio Quartulli,
	Antonio Quartulli

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

Hi Antonio,

[auto build test WARNING on mac80211-next/master]
[also build test WARNING on v4.3 next-20151113]

url:    https://github.com/0day-ci/linux/commits/Antonio-Quartulli/nl80211-add-flag-to-force-passive-scan-on-DFS-channels/20151114-025331
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master
config: x86_64-randconfig-s4-11140343 (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   In file included from include/linux/linkage.h:4:0,
                    from include/linux/kernel.h:6,
                    from include/linux/skbuff.h:17,
                    from include/linux/if_arp.h:26,
                    from net/mac80211/scan.c:16:
   net/mac80211/scan.c: In function '__ieee80211_start_scan':
   net/mac80211/scan.c:603:9: error: 'chan' undeclared (first use in this function)
          ((chan->flags & IEEE80211_CHAN_RADAR) &&
            ^
   include/linux/compiler.h:147:28: note: in definition of macro '__trace_if'
     if (__builtin_constant_p((cond)) ? !!(cond) :   \
                               ^
>> net/mac80211/scan.c:600:3: note: in expansion of macro 'if'
      if ((req->channels[0]->flags &
      ^
   net/mac80211/scan.c:603:9: note: each undeclared identifier is reported only once for each function it appears in
          ((chan->flags & IEEE80211_CHAN_RADAR) &&
            ^
   include/linux/compiler.h:147:28: note: in definition of macro '__trace_if'
     if (__builtin_constant_p((cond)) ? !!(cond) :   \
                               ^
>> net/mac80211/scan.c:600:3: note: in expansion of macro 'if'
      if ((req->channels[0]->flags &
      ^
   net/mac80211/scan.c:604:9: error: 'scan_req' undeclared (first use in this function)
           (scan_req->flags & NL80211_SCAN_FLAG_PASSIVE_RADAR))) {
            ^
   include/linux/compiler.h:147:28: note: in definition of macro '__trace_if'
     if (__builtin_constant_p((cond)) ? !!(cond) :   \
                               ^
>> net/mac80211/scan.c:600:3: note: in expansion of macro 'if'
      if ((req->channels[0]->flags &
      ^
   net/mac80211/scan.c: In function 'ieee80211_scan_get_channel_time':
   net/mac80211/scan.c:652:8: error: 'scan_req' undeclared (first use in this function)
          (scan_req->flags & NL80211_SCAN_FLAG_PASSIVE_RADAR)))
           ^
   include/linux/compiler.h:147:28: note: in definition of macro '__trace_if'
     if (__builtin_constant_p((cond)) ? !!(cond) :   \
                               ^
   net/mac80211/scan.c:650:2: note: in expansion of macro 'if'
     if ((chan->flags & IEEE80211_CHAN_NO_IR) ||
     ^

vim +/if +600 net/mac80211/scan.c

8a690674 Ben Greear        2012-04-17  584  		 */
8a690674 Ben Greear        2012-04-17  585  		unsigned long next_delay;
8a690674 Ben Greear        2012-04-17  586  
8a690674 Ben Greear        2012-04-17  587  		__set_bit(SCAN_ONCHANNEL_SCANNING, &local->scanning);
8a690674 Ben Greear        2012-04-17  588  
8a690674 Ben Greear        2012-04-17  589  		ieee80211_recalc_idle(local);
8a690674 Ben Greear        2012-04-17  590  
8a690674 Ben Greear        2012-04-17  591  		/* Notify driver scan is starting, keep order of operations
8a690674 Ben Greear        2012-04-17  592  		 * same as normal software scan, in case that matters. */
a344d677 Johannes Berg     2014-06-12  593  		drv_sw_scan_start(local, sdata, local->scan_addr);
8a690674 Ben Greear        2012-04-17  594  
8a690674 Ben Greear        2012-04-17  595  		ieee80211_configure_filter(local); /* accept probe-responses */
8a690674 Ben Greear        2012-04-17  596  
8a690674 Ben Greear        2012-04-17  597  		/* We need to ensure power level is at max for scanning. */
8a690674 Ben Greear        2012-04-17  598  		ieee80211_hw_config(local, 0);
8a690674 Ben Greear        2012-04-17  599  
8a690674 Ben Greear        2012-04-17 @600  		if ((req->channels[0]->flags &
8fe02e16 Luis R. Rodriguez 2013-10-21  601  		     IEEE80211_CHAN_NO_IR) ||
a55b8b39 Antonio Quartulli 2015-11-14  602  		    !req->n_ssids ||
a55b8b39 Antonio Quartulli 2015-11-14  603  		    ((chan->flags & IEEE80211_CHAN_RADAR) &&
a55b8b39 Antonio Quartulli 2015-11-14  604  		     (scan_req->flags & NL80211_SCAN_FLAG_PASSIVE_RADAR))) {
8a690674 Ben Greear        2012-04-17  605  			next_delay = IEEE80211_PASSIVE_CHANNEL_TIME;
8a690674 Ben Greear        2012-04-17  606  		} else {
8a690674 Ben Greear        2012-04-17  607  			ieee80211_scan_state_send_probe(local, &next_delay);
8a690674 Ben Greear        2012-04-17  608  			next_delay = IEEE80211_CHANNEL_TIME;

:::::: The code at line 600 was first introduced by commit
:::::: 8a690674e0601efbe9a7b16a5826fc522645cca3 mac80211: Support on-channel scan option.

:::::: TO: Ben Greear <greearb@candelatech.com>
:::::: CC: John W. Linville <linville@tuxdriver.com>

---
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: 23073 bytes --]

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

end of thread, other threads:[~2015-11-13 20:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-13 17:56 [PATCH 1/2] nl80211: add flag to force passive scan on DFS channels Antonio Quartulli
2015-11-13 17:56 ` [PATCH 2/2] mac80211: passively scan DFS channels if requested Antonio Quartulli
2015-11-13 19:19   ` kbuild test robot
2015-11-13 20:19   ` 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).