linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mac80211: fix BSS info reconfiguration
@ 2010-05-05  7:44 Johannes Berg
  2010-05-05  7:47 ` Johannes Berg
  0 siblings, 1 reply; 2+ messages in thread
From: Johannes Berg @ 2010-05-05  7:44 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless, Reinette Chatre

When reconfiguring an interface due to a previous
hardware restart, mac80211 will currently include
the new IBSS flag on non-IBSS interfaces which may
confuse drivers.

Instead of doing the ~0 trick, simply spell out
which things are going to be reconfigured.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 include/net/mac80211.h |    2 ++
 net/mac80211/util.c    |   25 ++++++++++++++++++++-----
 2 files changed, 22 insertions(+), 5 deletions(-)

--- wireless-testing.orig/include/net/mac80211.h	2010-05-01 08:47:54.000000000 +0200
+++ wireless-testing/include/net/mac80211.h	2010-05-05 09:41:46.000000000 +0200
@@ -160,6 +160,8 @@ enum ieee80211_bss_change {
 	BSS_CHANGED_BEACON_ENABLED	= 1<<9,
 	BSS_CHANGED_CQM			= 1<<10,
 	BSS_CHANGED_IBSS		= 1<<11,
+
+	/* when adding here, make sure to change ieee80211_reconfig */
 };
 
 /**
--- wireless-testing.orig/net/mac80211/util.c	2010-04-09 11:46:46.000000000 +0200
+++ wireless-testing/net/mac80211/util.c	2010-05-05 09:41:46.000000000 +0200
@@ -1160,18 +1160,33 @@ int ieee80211_reconfig(struct ieee80211_
 
 	/* Finally also reconfigure all the BSS information */
 	list_for_each_entry(sdata, &local->interfaces, list) {
-		u32 changed = ~0;
+		u32 changed;
+
 		if (!ieee80211_sdata_running(sdata))
 			continue;
+
+		/* common change flags for all interface types */
+		changed = BSS_CHANGED_ERP_CTS_PROT |
+			  BSS_CHANGED_ERP_PREAMBLE |
+			  BSS_CHANGED_ERP_SLOT |
+			  BSS_CHANGED_HT |
+			  BSS_CHANGED_BASIC_RATES |
+			  BSS_CHANGED_BEACON_INT |
+			  BSS_CHANGED_BSSID |
+			  BSS_CHANGED_CQM;
+
 		switch (sdata->vif.type) {
 		case NL80211_IFTYPE_STATION:
-			/* disable beacon change bits */
-			changed &= ~(BSS_CHANGED_BEACON |
-				     BSS_CHANGED_BEACON_ENABLED);
-			/* fall through */
+			changed |= BSS_CHANGED_ASSOC;
+			ieee80211_bss_info_change_notify(sdata, changed);
+			break;
 		case NL80211_IFTYPE_ADHOC:
+			changed |= BSS_CHANGED_IBSS;
+			/* fall through */
 		case NL80211_IFTYPE_AP:
 		case NL80211_IFTYPE_MESH_POINT:
+			changed |= BSS_CHANGED_BEACON |
+				   BSS_CHANGED_BEACON_ENABLED;
 			ieee80211_bss_info_change_notify(sdata, changed);
 			break;
 		case NL80211_IFTYPE_WDS:



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

* Re: [PATCH] mac80211: fix BSS info reconfiguration
  2010-05-05  7:44 [PATCH] mac80211: fix BSS info reconfiguration Johannes Berg
@ 2010-05-05  7:47 ` Johannes Berg
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2010-05-05  7:47 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless, Reinette Chatre

On Wed, 2010-05-05 at 09:44 +0200, Johannes Berg wrote:
> When reconfiguring an interface due to a previous
> hardware restart, mac80211 will currently include
> the new IBSS flag on non-IBSS interfaces which may
> confuse drivers.
> 
> Instead of doing the ~0 trick, simply spell out
> which things are going to be reconfigured.
> 
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Oops, that might get confusing.

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

though I'm still me either way I think.

> ---
>  include/net/mac80211.h |    2 ++
>  net/mac80211/util.c    |   25 ++++++++++++++++++++-----
>  2 files changed, 22 insertions(+), 5 deletions(-)
> 
> --- wireless-testing.orig/include/net/mac80211.h	2010-05-01 08:47:54.000000000 +0200
> +++ wireless-testing/include/net/mac80211.h	2010-05-05 09:41:46.000000000 +0200
> @@ -160,6 +160,8 @@ enum ieee80211_bss_change {
>  	BSS_CHANGED_BEACON_ENABLED	= 1<<9,
>  	BSS_CHANGED_CQM			= 1<<10,
>  	BSS_CHANGED_IBSS		= 1<<11,
> +
> +	/* when adding here, make sure to change ieee80211_reconfig */
>  };
>  
>  /**
> --- wireless-testing.orig/net/mac80211/util.c	2010-04-09 11:46:46.000000000 +0200
> +++ wireless-testing/net/mac80211/util.c	2010-05-05 09:41:46.000000000 +0200
> @@ -1160,18 +1160,33 @@ int ieee80211_reconfig(struct ieee80211_
>  
>  	/* Finally also reconfigure all the BSS information */
>  	list_for_each_entry(sdata, &local->interfaces, list) {
> -		u32 changed = ~0;
> +		u32 changed;
> +
>  		if (!ieee80211_sdata_running(sdata))
>  			continue;
> +
> +		/* common change flags for all interface types */
> +		changed = BSS_CHANGED_ERP_CTS_PROT |
> +			  BSS_CHANGED_ERP_PREAMBLE |
> +			  BSS_CHANGED_ERP_SLOT |
> +			  BSS_CHANGED_HT |
> +			  BSS_CHANGED_BASIC_RATES |
> +			  BSS_CHANGED_BEACON_INT |
> +			  BSS_CHANGED_BSSID |
> +			  BSS_CHANGED_CQM;
> +
>  		switch (sdata->vif.type) {
>  		case NL80211_IFTYPE_STATION:
> -			/* disable beacon change bits */
> -			changed &= ~(BSS_CHANGED_BEACON |
> -				     BSS_CHANGED_BEACON_ENABLED);
> -			/* fall through */
> +			changed |= BSS_CHANGED_ASSOC;
> +			ieee80211_bss_info_change_notify(sdata, changed);
> +			break;
>  		case NL80211_IFTYPE_ADHOC:
> +			changed |= BSS_CHANGED_IBSS;
> +			/* fall through */
>  		case NL80211_IFTYPE_AP:
>  		case NL80211_IFTYPE_MESH_POINT:
> +			changed |= BSS_CHANGED_BEACON |
> +				   BSS_CHANGED_BEACON_ENABLED;
>  			ieee80211_bss_info_change_notify(sdata, changed);
>  			break;
>  		case NL80211_IFTYPE_WDS:
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 



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

end of thread, other threads:[~2010-05-05  7:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-05  7:44 [PATCH] mac80211: fix BSS info reconfiguration Johannes Berg
2010-05-05  7:47 ` 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).