linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] mac80211: Disable requests for new scans in AP mode
@ 2008-12-09 14:57 Jouni Malinen
  2008-12-09 15:10 ` Johannes Berg
  2008-12-09 17:40 ` Dan Williams
  0 siblings, 2 replies; 7+ messages in thread
From: Jouni Malinen @ 2008-12-09 14:57 UTC (permalink / raw)
  To: linux-wireless

AP mode operations are seriously affected if mac80211 runs through a
multi-second scan while the AP is trying to send Beacon frames on the
operation channel. While this could be implemented in a way that does
not cause too many problems, it is not very simple and will require
synchronization with Beacon frame scheduling in the drivers (scan one
channel at a time between Beacon frames). Furthermore, such scanning
takes quite a bit longer time and existing userspace applications
would be likely to timeout while waiting for the results.

For now, just refuse requests for new scans (SIOCSIWSCAN) when in AP
mode. In practice, this moves the rejection from iwl* drivers into
mac80211 to make it apply to every mac80211-based driver.

This issue shows up in associated stations getting disconnected when
something (e.g., Network Manager) requests a scan while the interface
is in AP mode. When doing this continuously (e.g., NM does it every 60
seconds), the network gets close to useless.

Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>


Index: wireless-testing/drivers/net/wireless/iwlwifi/iwl-agn.c
===================================================================
--- wireless-testing.orig/drivers/net/wireless/iwlwifi/iwl-agn.c	2008-12-09 16:27:49.000000000 +0200
+++ wireless-testing/drivers/net/wireless/iwlwifi/iwl-agn.c	2008-12-09 16:31:25.000000000 +0200
@@ -2972,12 +2972,6 @@ static int iwl_mac_hw_scan(struct ieee80
 		goto out_unlock;
 	}
 
-	if (priv->iw_mode == NL80211_IFTYPE_AP) {	/* APs don't scan */
-		ret = -EIO;
-		IWL_ERROR("ERROR: APs don't scan\n");
-		goto out_unlock;
-	}
-
 	/* We don't schedule scan within next_scan_jiffies period.
 	 * Avoid scanning during possible EAPOL exchange, return
 	 * success immediately.
Index: wireless-testing/drivers/net/wireless/iwlwifi/iwl3945-base.c
===================================================================
--- wireless-testing.orig/drivers/net/wireless/iwlwifi/iwl3945-base.c	2008-12-09 16:34:51.000000000 +0200
+++ wireless-testing/drivers/net/wireless/iwlwifi/iwl3945-base.c	2008-12-09 16:35:14.000000000 +0200
@@ -2105,11 +2105,6 @@ static void iwl3945_setup_rxon_timing(st
 
 static int iwl3945_scan_initiate(struct iwl3945_priv *priv)
 {
-	if (priv->iw_mode == NL80211_IFTYPE_AP) {
-		IWL_ERROR("APs don't scan.\n");
-		return 0;
-	}
-
 	if (!iwl3945_is_ready_rf(priv)) {
 		IWL_DEBUG_SCAN("Aborting scan due to not ready.\n");
 		return -EIO;
@@ -6991,12 +6986,6 @@ static int iwl3945_mac_hw_scan(struct ie
 		goto out_unlock;
 	}
 
-	if (priv->iw_mode == NL80211_IFTYPE_AP) {	/* APs don't scan */
-		rc = -EIO;
-		IWL_ERROR("ERROR: APs don't scan\n");
-		goto out_unlock;
-	}
-
 	/* we don't schedule scan within next_scan_jiffies period */
 	if (priv->next_scan_jiffies &&
 			time_after(priv->next_scan_jiffies, jiffies)) {
Index: wireless-testing/net/mac80211/wext.c
===================================================================
--- wireless-testing.orig/net/mac80211/wext.c	2008-12-09 16:31:01.000000000 +0200
+++ wireless-testing/net/mac80211/wext.c	2008-12-09 16:31:13.000000000 +0200
@@ -418,8 +418,7 @@ static int ieee80211_ioctl_siwscan(struc
 
 	if (sdata->vif.type != NL80211_IFTYPE_STATION &&
 	    sdata->vif.type != NL80211_IFTYPE_ADHOC &&
-	    sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
-	    sdata->vif.type != NL80211_IFTYPE_AP)
+	    sdata->vif.type != NL80211_IFTYPE_MESH_POINT)
 		return -EOPNOTSUPP;
 
 	/* if SSID was specified explicitly then use that */

-- 
Jouni Malinen                                            PGP id EFC895FA

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

* Re: [RFC] mac80211: Disable requests for new scans in AP mode
  2008-12-09 14:57 [RFC] mac80211: Disable requests for new scans in AP mode Jouni Malinen
@ 2008-12-09 15:10 ` Johannes Berg
  2008-12-09 17:40 ` Dan Williams
  1 sibling, 0 replies; 7+ messages in thread
From: Johannes Berg @ 2008-12-09 15:10 UTC (permalink / raw)
  To: Jouni Malinen; +Cc: linux-wireless

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

On Tue, 2008-12-09 at 16:57 +0200, Jouni Malinen wrote:
> AP mode operations are seriously affected if mac80211 runs through a
> multi-second scan while the AP is trying to send Beacon frames on the
> operation channel. While this could be implemented in a way that does
> not cause too many problems, it is not very simple and will require
> synchronization with Beacon frame scheduling in the drivers (scan one
> channel at a time between Beacon frames). Furthermore, such scanning
> takes quite a bit longer time and existing userspace applications
> would be likely to timeout while waiting for the results.
> 
> For now, just refuse requests for new scans (SIOCSIWSCAN) when in AP
> mode. In practice, this moves the rejection from iwl* drivers into
> mac80211 to make it apply to every mac80211-based driver.
> 
> This issue shows up in associated stations getting disconnected when
> something (e.g., Network Manager) requests a scan while the interface
> is in AP mode. When doing this continuously (e.g., NM does it every 60
> seconds), the network gets close to useless.
> 
> Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>

Acked-by: Johannes Berg <johannes@sipsolutions.net>

> 
> Index: wireless-testing/drivers/net/wireless/iwlwifi/iwl-agn.c
> ===================================================================
> --- wireless-testing.orig/drivers/net/wireless/iwlwifi/iwl-agn.c	2008-12-09 16:27:49.000000000 +0200
> +++ wireless-testing/drivers/net/wireless/iwlwifi/iwl-agn.c	2008-12-09 16:31:25.000000000 +0200
> @@ -2972,12 +2972,6 @@ static int iwl_mac_hw_scan(struct ieee80
>  		goto out_unlock;
>  	}
>  
> -	if (priv->iw_mode == NL80211_IFTYPE_AP) {	/* APs don't scan */
> -		ret = -EIO;
> -		IWL_ERROR("ERROR: APs don't scan\n");
> -		goto out_unlock;
> -	}
> -
>  	/* We don't schedule scan within next_scan_jiffies period.
>  	 * Avoid scanning during possible EAPOL exchange, return
>  	 * success immediately.
> Index: wireless-testing/drivers/net/wireless/iwlwifi/iwl3945-base.c
> ===================================================================
> --- wireless-testing.orig/drivers/net/wireless/iwlwifi/iwl3945-base.c	2008-12-09 16:34:51.000000000 +0200
> +++ wireless-testing/drivers/net/wireless/iwlwifi/iwl3945-base.c	2008-12-09 16:35:14.000000000 +0200
> @@ -2105,11 +2105,6 @@ static void iwl3945_setup_rxon_timing(st
>  
>  static int iwl3945_scan_initiate(struct iwl3945_priv *priv)
>  {
> -	if (priv->iw_mode == NL80211_IFTYPE_AP) {
> -		IWL_ERROR("APs don't scan.\n");
> -		return 0;
> -	}
> -
>  	if (!iwl3945_is_ready_rf(priv)) {
>  		IWL_DEBUG_SCAN("Aborting scan due to not ready.\n");
>  		return -EIO;
> @@ -6991,12 +6986,6 @@ static int iwl3945_mac_hw_scan(struct ie
>  		goto out_unlock;
>  	}
>  
> -	if (priv->iw_mode == NL80211_IFTYPE_AP) {	/* APs don't scan */
> -		rc = -EIO;
> -		IWL_ERROR("ERROR: APs don't scan\n");
> -		goto out_unlock;
> -	}
> -
>  	/* we don't schedule scan within next_scan_jiffies period */
>  	if (priv->next_scan_jiffies &&
>  			time_after(priv->next_scan_jiffies, jiffies)) {
> Index: wireless-testing/net/mac80211/wext.c
> ===================================================================
> --- wireless-testing.orig/net/mac80211/wext.c	2008-12-09 16:31:01.000000000 +0200
> +++ wireless-testing/net/mac80211/wext.c	2008-12-09 16:31:13.000000000 +0200
> @@ -418,8 +418,7 @@ static int ieee80211_ioctl_siwscan(struc
>  
>  	if (sdata->vif.type != NL80211_IFTYPE_STATION &&
>  	    sdata->vif.type != NL80211_IFTYPE_ADHOC &&
> -	    sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
> -	    sdata->vif.type != NL80211_IFTYPE_AP)
> +	    sdata->vif.type != NL80211_IFTYPE_MESH_POINT)
>  		return -EOPNOTSUPP;
>  
>  	/* if SSID was specified explicitly then use that */
> 

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [RFC] mac80211: Disable requests for new scans in AP mode
  2008-12-09 14:57 [RFC] mac80211: Disable requests for new scans in AP mode Jouni Malinen
  2008-12-09 15:10 ` Johannes Berg
@ 2008-12-09 17:40 ` Dan Williams
  2008-12-09 19:33   ` Jouni Malinen
  1 sibling, 1 reply; 7+ messages in thread
From: Dan Williams @ 2008-12-09 17:40 UTC (permalink / raw)
  To: Jouni Malinen; +Cc: linux-wireless

On Tue, 2008-12-09 at 16:57 +0200, Jouni Malinen wrote:
> AP mode operations are seriously affected if mac80211 runs through a
> multi-second scan while the AP is trying to send Beacon frames on the
> operation channel. While this could be implemented in a way that does
> not cause too many problems, it is not very simple and will require
> synchronization with Beacon frame scheduling in the drivers (scan one
> channel at a time between Beacon frames). Furthermore, such scanning
> takes quite a bit longer time and existing userspace applications
> would be likely to timeout while waiting for the results.
> 
> For now, just refuse requests for new scans (SIOCSIWSCAN) when in AP
> mode. In practice, this moves the rejection from iwl* drivers into
> mac80211 to make it apply to every mac80211-based driver.
> 
> This issue shows up in associated stations getting disconnected when
> something (e.g., Network Manager) requests a scan while the interface
> is in AP mode. When doing this continuously (e.g., NM does it every 60
> seconds), the network gets close to useless.

Every 120 seconds usually (it uses a simple backoff algorithm), but
yeah, this is a good thing to do.  You probably want to make NM ignore
the device if you're configuring it as an AP though, since obviously NM
shouldn't be driving an AP mode interface.

Dan

> Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>
> 
> 
> Index: wireless-testing/drivers/net/wireless/iwlwifi/iwl-agn.c
> ===================================================================
> --- wireless-testing.orig/drivers/net/wireless/iwlwifi/iwl-agn.c	2008-12-09 16:27:49.000000000 +0200
> +++ wireless-testing/drivers/net/wireless/iwlwifi/iwl-agn.c	2008-12-09 16:31:25.000000000 +0200
> @@ -2972,12 +2972,6 @@ static int iwl_mac_hw_scan(struct ieee80
>  		goto out_unlock;
>  	}
>  
> -	if (priv->iw_mode == NL80211_IFTYPE_AP) {	/* APs don't scan */
> -		ret = -EIO;
> -		IWL_ERROR("ERROR: APs don't scan\n");
> -		goto out_unlock;
> -	}
> -
>  	/* We don't schedule scan within next_scan_jiffies period.
>  	 * Avoid scanning during possible EAPOL exchange, return
>  	 * success immediately.
> Index: wireless-testing/drivers/net/wireless/iwlwifi/iwl3945-base.c
> ===================================================================
> --- wireless-testing.orig/drivers/net/wireless/iwlwifi/iwl3945-base.c	2008-12-09 16:34:51.000000000 +0200
> +++ wireless-testing/drivers/net/wireless/iwlwifi/iwl3945-base.c	2008-12-09 16:35:14.000000000 +0200
> @@ -2105,11 +2105,6 @@ static void iwl3945_setup_rxon_timing(st
>  
>  static int iwl3945_scan_initiate(struct iwl3945_priv *priv)
>  {
> -	if (priv->iw_mode == NL80211_IFTYPE_AP) {
> -		IWL_ERROR("APs don't scan.\n");
> -		return 0;
> -	}
> -
>  	if (!iwl3945_is_ready_rf(priv)) {
>  		IWL_DEBUG_SCAN("Aborting scan due to not ready.\n");
>  		return -EIO;
> @@ -6991,12 +6986,6 @@ static int iwl3945_mac_hw_scan(struct ie
>  		goto out_unlock;
>  	}
>  
> -	if (priv->iw_mode == NL80211_IFTYPE_AP) {	/* APs don't scan */
> -		rc = -EIO;
> -		IWL_ERROR("ERROR: APs don't scan\n");
> -		goto out_unlock;
> -	}
> -
>  	/* we don't schedule scan within next_scan_jiffies period */
>  	if (priv->next_scan_jiffies &&
>  			time_after(priv->next_scan_jiffies, jiffies)) {
> Index: wireless-testing/net/mac80211/wext.c
> ===================================================================
> --- wireless-testing.orig/net/mac80211/wext.c	2008-12-09 16:31:01.000000000 +0200
> +++ wireless-testing/net/mac80211/wext.c	2008-12-09 16:31:13.000000000 +0200
> @@ -418,8 +418,7 @@ static int ieee80211_ioctl_siwscan(struc
>  
>  	if (sdata->vif.type != NL80211_IFTYPE_STATION &&
>  	    sdata->vif.type != NL80211_IFTYPE_ADHOC &&
> -	    sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
> -	    sdata->vif.type != NL80211_IFTYPE_AP)
> +	    sdata->vif.type != NL80211_IFTYPE_MESH_POINT)
>  		return -EOPNOTSUPP;
>  
>  	/* if SSID was specified explicitly then use that */
> 


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

* Re: [RFC] mac80211: Disable requests for new scans in AP mode
  2008-12-09 17:40 ` Dan Williams
@ 2008-12-09 19:33   ` Jouni Malinen
  2008-12-09 20:07     ` Dan Williams
  0 siblings, 1 reply; 7+ messages in thread
From: Jouni Malinen @ 2008-12-09 19:33 UTC (permalink / raw)
  To: Dan Williams; +Cc: linux-wireless

On Tue, Dec 09, 2008 at 12:40:10PM -0500, Dan Williams wrote:

> Every 120 seconds usually (it uses a simple backoff algorithm), but
> yeah, this is a good thing to do.  You probably want to make NM ignore
> the device if you're configuring it as an AP though, since obviously NM
> shouldn't be driving an AP mode interface.

Actually, I would like to be able to NM to set up a simple AP similarly
to IBSS configuration.. If I'm setting up the interface manually (either
for AP or even for client modes), I would like NM to ignore the device
from that point on, but that is a separate point.

-- 
Jouni Malinen                                            PGP id EFC895FA

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

* Re: [RFC] mac80211: Disable requests for new scans in AP mode
  2008-12-09 19:33   ` Jouni Malinen
@ 2008-12-09 20:07     ` Dan Williams
  2008-12-09 21:11       ` Johannes Berg
  2008-12-09 21:12       ` Johannes Berg
  0 siblings, 2 replies; 7+ messages in thread
From: Dan Williams @ 2008-12-09 20:07 UTC (permalink / raw)
  To: Jouni Malinen; +Cc: linux-wireless

On Tue, 2008-12-09 at 21:33 +0200, Jouni Malinen wrote:
> On Tue, Dec 09, 2008 at 12:40:10PM -0500, Dan Williams wrote:
> 
> > Every 120 seconds usually (it uses a simple backoff algorithm), but
> > yeah, this is a good thing to do.  You probably want to make NM ignore
> > the device if you're configuring it as an AP though, since obviously NM
> > shouldn't be driving an AP mode interface.
> 
> Actually, I would like to be able to NM to set up a simple AP similarly
> to IBSS configuration.. If I'm setting up the interface manually (either
> for AP or even for client modes), I would like NM to ignore the device
> from that point on, but that is a separate point.

NM only knows about devices that NM controls, thus we can't have NM set
up the device and then subsequently ignore it...  However, at some point
in the near future, if we can get reliable information as to whether the
driver *does* in fact support AP mode, we can make NM drive the
interface in AP mode instead of IBSS.  The only reason it's using IBSS
right now is that the driver support for AP mode was so inconsistent and
buggy.

Dan


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

* Re: [RFC] mac80211: Disable requests for new scans in AP mode
  2008-12-09 20:07     ` Dan Williams
@ 2008-12-09 21:11       ` Johannes Berg
  2008-12-09 21:12       ` Johannes Berg
  1 sibling, 0 replies; 7+ messages in thread
From: Johannes Berg @ 2008-12-09 21:11 UTC (permalink / raw)
  To: Dan Williams; +Cc: Jouni Malinen, linux-wireless

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

On Tue, 2008-12-09 at 15:07 -0500, Dan Williams wrote:

> NM only knows about devices that NM controls, thus we can't have NM set
> up the device and then subsequently ignore it...  However, at some point
> in the near future, if we can get reliable information as to whether the
> driver *does* in fact support AP mode, we can make NM drive the
> interface in AP mode instead of IBSS.  The only reason it's using IBSS
> right now is that the driver support for AP mode was so inconsistent and
> buggy.

We can get that information now, iw already prints it:

johannes:~$ iw list
Wiphy phy0
	...
	Supported interface modes:
		 * IBSS
		 * Station
		 * AP
		 * AP(VLAN)
		 * WDS
		 * Monitor
		 * mesh point

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [RFC] mac80211: Disable requests for new scans in AP mode
  2008-12-09 20:07     ` Dan Williams
  2008-12-09 21:11       ` Johannes Berg
@ 2008-12-09 21:12       ` Johannes Berg
  1 sibling, 0 replies; 7+ messages in thread
From: Johannes Berg @ 2008-12-09 21:12 UTC (permalink / raw)
  To: Dan Williams; +Cc: Jouni Malinen, linux-wireless

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

On Tue, 2008-12-09 at 15:07 -0500, Dan Williams wrote:

> NM only knows about devices that NM controls, thus we can't have NM set
> up the device and then subsequently ignore it...  However, at some point
> in the near future, if we can get reliable information as to whether the
> driver *does* in fact support AP mode, we can make NM drive the
> interface in AP mode instead of IBSS.  The only reason it's using IBSS
> right now is that the driver support for AP mode was so inconsistent and
> buggy.

Somebody (Intel, I think? Or MS?) has also been showing off
functionality like STA + IBSS (or AP) on one hardware. We totally should
beat them to the market with that :) Needs driver work, though.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2008-12-09 21:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-09 14:57 [RFC] mac80211: Disable requests for new scans in AP mode Jouni Malinen
2008-12-09 15:10 ` Johannes Berg
2008-12-09 17:40 ` Dan Williams
2008-12-09 19:33   ` Jouni Malinen
2008-12-09 20:07     ` Dan Williams
2008-12-09 21:11       ` Johannes Berg
2008-12-09 21:12       ` Johannes Berg

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).