Skip to contentSkip to conversation

nl80211: add flag to force passive scan on DFS channels

PATCH Superseded Antonio Quartulli 2 participants 4 messages Nov 13, 2015

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 nl80211: add flag to force passive scan on DFS channels

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.

---
 include/uapi/linux/nl80211.h | 2 ++
 1 file changed, 2 insertions(+)
include/uapi/linux/nl80211.h +2 -0
index 1f0b4cf..2083e53 100644
@@ -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,
 };
 
 /**
Signature · 1 line
2.6.3
#1 lore raw

PATCH 2/2 mac80211: passively scan DFS channels if requested

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

---
 net/mac80211/scan.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
net/mac80211/scan.c +9 -3
index 4aeca4b..d8f7b4a 100644
@@ -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;
Signature · 1 line
2.6.3
#2 lore raw

Re: [PATCH 2/2] mac80211: passively scan DFS channels if requested

reproduce:

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

#3 lore raw

Re: [PATCH 2/2] mac80211: passively scan DFS channels if requested

In reply to Antonio Quartulli
reproduce:

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 <[email protected]> :::::: CC: John W. Linville <[email protected]>

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