linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] cfg80211: Parse channel_type in NL80211_CMD_JOIN_IBSS
@ 2010-05-05 22:36 Benoit Papillault
  2010-05-05 22:36 ` [PATCH v2] mac80211: Add HT IE to IBSS beacons and probe responses Benoit Papillault
  0 siblings, 1 reply; 9+ messages in thread
From: Benoit Papillault @ 2010-05-05 22:36 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Benoit Papillault

The channel_type field is filled by iw and parse by cfg80211 before
being sent to mac80211 for instance (we also check if the specified
channel is capable of ht40+, ht40- or ht20). This information is needed
to properly configure an HT IBSS.

It requires a patch to iw to fill this field.

Signed-off-by: Benoit Papillault <benoit.papillault@free.fr>
---
 include/net/cfg80211.h |    1 +
 net/wireless/nl80211.c |   20 ++++++++++++++++----
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 7d10c01..93e5558 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -806,6 +806,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 --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 01da83d..0a82623 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -3792,6 +3792,7 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info)
 	struct cfg80211_ibss_params ibss;
 	struct wiphy *wiphy;
 	struct cfg80211_cached_keys *connkeys = NULL;
+	enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT;
 	int err;
 
 	memset(&ibss, 0, sizeof(ibss));
@@ -3813,6 +3814,17 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info)
 			return -EINVAL;
 	}
 
+	if (info->attrs[NL80211_ATTR_WIPHY_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;
+
 	rtnl_lock();
 
 	err = get_rdev_dev_by_info_ifindex(info, &rdev, &dev);
@@ -3846,11 +3858,11 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info)
 		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]));
+	ibss.channel = rdev_freq_to_chan(rdev,
+		nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]),
+		channel_type);
 	if (!ibss.channel ||
-	    ibss.channel->flags & IEEE80211_CHAN_NO_IBSS ||
-	    ibss.channel->flags & IEEE80211_CHAN_DISABLED) {
+	    ibss.channel->flags & IEEE80211_CHAN_NO_IBSS) {
 		err = -EINVAL;
 		goto out;
 	}
-- 
1.5.6.5


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

end of thread, other threads:[~2010-05-14 13:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-05 22:36 [PATCH v2] cfg80211: Parse channel_type in NL80211_CMD_JOIN_IBSS Benoit Papillault
2010-05-05 22:36 ` [PATCH v2] mac80211: Add HT IE to IBSS beacons and probe responses Benoit Papillault
2010-05-06  6:40   ` Johannes Berg
2010-05-07 23:01     ` Benoit Papillault
2010-05-11 10:48       ` Johannes Berg
2010-05-12 21:02         ` Benoit Papillault
2010-05-13  0:47           ` Bruno Randolf
2010-05-13  7:09             ` Benoit Papillault
2010-05-14 13:58           ` 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).