linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: linux-wireless@vger.kernel.org
Cc: Johannes Berg <johannes.berg@intel.com>
Subject: [RFC 08/20] mac80211: mesh: don't use global channel type
Date: Fri, 27 Jul 2012 13:16:44 +0200	[thread overview]
Message-ID: <1343387816-9414-9-git-send-email-johannes@sipsolutions.net> (raw)
In-Reply-To: <1343387816-9414-1-git-send-email-johannes@sipsolutions.net>

From: Johannes Berg <johannes.berg@intel.com>

Using local->_oper_channel_type in the mesh code is
completely wrong as this value is the combination
of the various interface channel types and can be
a different value from the mesh interface in case
there are multiple virtual interfaces.

Use sdata->vif.bss_conf.channel_type instead as it
tracks the per-vif channel type.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 net/mac80211/mesh.c       |   11 ++++++-----
 net/mac80211/mesh_plink.c |    7 ++++---
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index e6d1788..62d93ab 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -109,11 +109,11 @@ bool mesh_matches_local(struct ieee80211_sub_if_data *sdata,
 
 	/* Disallow HT40+/- mismatch */
 	if (ie->ht_operation &&
-	    (local->_oper_channel_type == NL80211_CHAN_HT40MINUS ||
-	    local->_oper_channel_type == NL80211_CHAN_HT40PLUS) &&
+	    (sdata->vif.bss_conf.channel_type == NL80211_CHAN_HT40MINUS ||
+	     sdata->vif.bss_conf.channel_type == NL80211_CHAN_HT40PLUS) &&
 	    (sta_channel_type == NL80211_CHAN_HT40MINUS ||
 	     sta_channel_type == NL80211_CHAN_HT40PLUS) &&
-	    local->_oper_channel_type != sta_channel_type)
+	    sdata->vif.bss_conf.channel_type != sta_channel_type)
 		goto mismatch;
 
 	return true;
@@ -375,7 +375,7 @@ int mesh_add_ht_cap_ie(struct sk_buff *skb,
 
 	sband = local->hw.wiphy->bands[local->oper_channel->band];
 	if (!sband->ht_cap.ht_supported ||
-	    local->_oper_channel_type == NL80211_CHAN_NO_HT)
+	    sdata->vif.bss_conf.channel_type == NL80211_CHAN_NO_HT)
 		return 0;
 
 	if (skb_tailroom(skb) < 2 + sizeof(struct ieee80211_ht_cap))
@@ -392,7 +392,8 @@ int mesh_add_ht_oper_ie(struct sk_buff *skb,
 {
 	struct ieee80211_local *local = sdata->local;
 	struct ieee80211_channel *channel = local->oper_channel;
-	enum nl80211_channel_type channel_type = local->_oper_channel_type;
+	enum nl80211_channel_type channel_type =
+				sdata->vif.bss_conf.channel_type;
 	struct ieee80211_supported_band *sband =
 				local->hw.wiphy->bands[channel->band];
 	struct ieee80211_sta_ht_cap *ht_cap = &sband->ht_cap;
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c
index 6df9fc0..a203166 100644
--- a/net/mac80211/mesh_plink.c
+++ b/net/mac80211/mesh_plink.c
@@ -117,7 +117,7 @@ static u32 mesh_set_ht_prot_mode(struct ieee80211_sub_if_data *sdata)
 	u16 ht_opmode;
 	bool non_ht_sta = false, ht20_sta = false;
 
-	if (local->_oper_channel_type == NL80211_CHAN_NO_HT)
+	if (sdata->vif.bss_conf.channel_type == NL80211_CHAN_NO_HT)
 		return 0;
 
 	rcu_read_lock();
@@ -147,7 +147,8 @@ out:
 
 	if (non_ht_sta)
 		ht_opmode = IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED;
-	else if (ht20_sta && local->_oper_channel_type > NL80211_CHAN_HT20)
+	else if (ht20_sta &&
+		 sdata->vif.bss_conf.channel_type > NL80211_CHAN_HT20)
 		ht_opmode = IEEE80211_HT_OP_MODE_PROTECTION_20MHZ;
 	else
 		ht_opmode = IEEE80211_HT_OP_MODE_PROTECTION_NONE;
@@ -370,7 +371,7 @@ static struct sta_info *mesh_peer_init(struct ieee80211_sub_if_data *sdata,
 
 	sta->sta.supp_rates[band] = rates;
 	if (elems->ht_cap_elem &&
-	    sdata->local->_oper_channel_type != NL80211_CHAN_NO_HT)
+	    sdata->vif.bss_conf.channel_type != NL80211_CHAN_NO_HT)
 		ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband,
 						  elems->ht_cap_elem,
 						  &sta->sta.ht_cap);
-- 
1.7.10.4


  parent reply	other threads:[~2012-07-27 11:17 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-27 11:16 [RFC 00/20] mac80211: multi-channel work Johannes Berg
2012-07-27 11:16 ` [RFC 01/20] mac80211: introduce channel context skeleton code Johannes Berg
2012-07-27 11:16 ` [RFC 02/20] mac80211: introduce new ieee80211_ops Johannes Berg
2012-07-27 11:16 ` [RFC 03/20] mac80211: add drv_* wrappers for channel contexts Johannes Berg
2012-07-27 18:08   ` Joe Perches
2012-07-27 21:03     ` Johannes Berg
2012-07-27 11:16 ` [RFC 04/20] mac80211: add chanctx tracing Johannes Berg
2012-07-27 11:16 ` [RFC 05/20] mac80211: use channel context notifications Johannes Berg
2012-07-27 11:16 ` [RFC 06/20] mac80211: refactor set_channel_type Johannes Berg
2012-07-29  9:03   ` Eliad Peller
2012-07-27 11:16 ` [RFC 07/20] mac80211: reuse channels for channel contexts Johannes Berg
2012-07-27 11:16 ` Johannes Berg [this message]
2012-07-27 11:16 ` [RFC 09/20] mac80211: remove almost unused local variable Johannes Berg
2012-07-27 11:16 ` [RFC 10/20] mac80211: remove freq/chantype from debugfs Johannes Berg
2012-07-27 11:16 ` [RFC 11/20] mac80211: use oper_channel in rate init Johannes Berg
2012-07-27 11:16 ` [RFC 12/20] mac80211: don't assume channel is set in tracing Johannes Berg
2012-07-27 11:16 ` [RFC 13/20] mac80211: use RX status band instead of current band Johannes Berg
2012-07-27 11:16 ` [RFC 14/20] mac80211: check operating channel in scan Johannes Berg
2012-07-27 11:16 ` [RFC 15/20] mac80211: convert ops checks to WARN_ON Johannes Berg
2012-07-27 11:16 ` [RFC 16/20] mac80211: check channel context methods Johannes Berg
2012-07-27 11:16 ` [RFC 17/20] mac80211: track whether to use channel contexts Johannes Berg
2012-07-27 11:16 ` [RFC 18/20] mac80211: allow drv_add_chanctx to fail Johannes Berg
2012-07-27 11:42   ` Michal Kazior
2012-07-27 11:42     ` Johannes Berg
2012-07-27 11:45       ` Michal Kazior
2012-07-27 11:16 ` [RFC 19/20] mac80211: return error code from ieee80211_vif_use_channel Johannes Berg
2012-07-27 11:16 ` [RFC 20/20] mac80211: use channel contexts Johannes Berg
2012-07-27 11:46   ` Michal Kazior
2012-07-27 11:55     ` Johannes Berg
2012-08-06 15:21   ` Arik Nemtsov
2012-08-06 15:26     ` Johannes Berg
2012-07-27 12:31 ` [RFC 00/20] mac80211: multi-channel work Johannes Berg
2012-08-24  9:29 ` Johannes Berg
2012-08-26  7:58   ` Eliad Peller
2012-08-26  8:10     ` Johannes Berg
2012-08-26  8:28       ` Eliad Peller
2012-08-26  8:30         ` Johannes Berg
2012-08-26  8:36           ` Eliad Peller
2012-09-05 14:03             ` Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1343387816-9414-9-git-send-email-johannes@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=johannes.berg@intel.com \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).