All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Simon <alexander.simon@saxnet.de>
To: linux-wireless@vger.kernel.org
Subject: [RFC v3 2/3] nl80211: channel type attribute for IBSS
Date: Tue, 21 Jun 2011 17:52:24 +0200	[thread overview]
Message-ID: <1308671544.2656.8.camel@alex-2> (raw)
In-Reply-To: <1308671129.2656.4.camel@alex-2>

Allow nl80211 to set a ht channel for ibss.

Signed-off-by: Alexander Simon <alexander.simon@saxnet.de>
---
 include/net/cfg80211.h |    1 +
 net/wireless/nl80211.c |   33 +++++++++++++++++++++++++++++----
 2 files changed, 30 insertions(+), 4 deletions(-)

diff -Nrup a/include/net/cfg80211.h b/include/net/cfg80211.h
--- a/include/net/cfg80211.h	2011-06-01 21:04:33.000000000 +0200
+++ b/include/net/cfg80211.h	2011-06-21 13:21:38.000000000 +0200
@@ -1038,6 +1038,7 @@ struct cfg80211_ibss_params {
 	u8 *ssid;
 	u8 *bssid;
 	struct ieee80211_channel *channel;
+	enum nl80211_channel_type channel_type;
 	u8 *ie;
 	u8 ssid_len, ie_len;
 	u16 beacon_interval;
diff -Nrup a/net/wireless/nl80211.c b/net/wireless/nl80211.c
--- a/net/wireless/nl80211.c	2011-06-01 21:04:33.000000000 +0200
+++ b/net/wireless/nl80211.c	2011-06-21 13:21:38.000000000 +0200
@@ -4266,12 +4266,37 @@ static int nl80211_join_ibss(struct sk_b
 		ibss.ie_len = nla_len(info->attrs[NL80211_ATTR_IE]);
 	}
 
-	ibss.channel = ieee80211_get_channel(wiphy,
-		nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]));
-	if (!ibss.channel ||
+	if (info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]) {
+		enum nl80211_channel_type channel_type;
+
+		channel_type = nla_get_u32(
+			info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]);
+		if (channel_type != NL80211_CHAN_NO_HT &&
+		    channel_type != NL80211_CHAN_HT20 &&
+		    channel_type != NL80211_CHAN_HT40PLUS &&
+		    channel_type != NL80211_CHAN_HT40MINUS)
+			return -EINVAL;
+		ibss.channel_type = channel_type;
+	} else {
+		ibss.channel_type = NL80211_CHAN_NO_HT;
+	}
+
+	ibss.channel = rdev_freq_to_chan(rdev,
+		nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]),
+		ibss.channel_type);
+	/*if (!ibss.channel ||
+	    ibss.channel->flags & IEEE80211_CHAN_PASSIVE_SCAN ||
 	    ibss.channel->flags & IEEE80211_CHAN_NO_IBSS ||
-	    ibss.channel->flags & IEEE80211_CHAN_DISABLED)
+	    ibss.channel->flags & IEEE80211_CHAN_RADAR)
+		return -EINVAL;
+	if ((ibss.channel_type == NL80211_CHAN_HT40PLUS ||
+	     ibss.channel_type == NL80211_CHAN_HT40MINUS) &&
+	    !can_beacon_sec_chan(&rdev->wiphy, ibss.chan, ibss.channel_type)) {
+		printk(KERN_DEBUG
+		       "cfg80211: Secondary channel not "
+		       "allowed to initiate communication\n");
 		return -EINVAL;
+	}*/
 
 	ibss.channel_fixed = !!info->attrs[NL80211_ATTR_FREQ_FIXED];
 	ibss.privacy = !!info->attrs[NL80211_ATTR_PRIVACY];




  reply	other threads:[~2011-06-21 15:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-21 15:45 [RFC v3 1/3] mac80211: add some helper functions Alexander Simon
2011-06-21 15:52 ` Alexander Simon [this message]
2011-06-24 18:56   ` [RFC v3 2/3] nl80211: channel type attribute for IBSS Felix Fietkau
2011-07-04 10:07     ` Alexander Simon
2011-07-04 10:10       ` Johannes Berg
2011-06-27 12:46   ` Johannes Berg
2011-06-21 15:53 ` [RFC v3 3/3] mac80211: HT operation in IBSS Alexander Simon
2011-06-24 19:21   ` Felix Fietkau
2011-06-27 12:50   ` Johannes Berg
2011-06-27 12:51   ` Johannes Berg
2011-06-21 16:01 ` patch for iw Alexander Simon
2011-06-27 12:42   ` Johannes Berg
2011-06-21 16:02 ` [RFC v3 1/3] mac80211: add some helper functions Johannes Berg
2011-06-24 19:01 ` Felix Fietkau
2011-06-27 12:46 ` 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=1308671544.2656.8.camel@alex-2 \
    --to=alexander.simon@saxnet.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.