aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/nl80211.c
diff options
context:
space:
mode:
authorSujith <Sujith.Manoharan@atheros.com>2008-12-12 01:27:43 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-12-19 15:22:54 -0500
commit094d05dc32fc2930e381189a942016e5561775d9 (patch)
tree4deedbcbe196f88cb8d9fe0cd0755775a7ff0939 /net/wireless/nl80211.c
parent420e7fabd9c6d907280ed6b3e40eef425c5d8d8d (diff)
mac80211: Fix HT channel selection
HT management is done differently for AP and STA modes, unify to just the ->config() callback since HT is fundamentally a PHY property and cannot be per-BSS. Rename enum nl80211_sec_chan_offset as nl80211_channel_type to denote the channel type ( NO_HT, HT20, HT40+, HT40- ). Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Sujith <Sujith.Manoharan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless/nl80211.c')
-rw-r--r--net/wireless/nl80211.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 93c9b983ce08..1e728fff474e 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -60,7 +60,7 @@ static struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] __read_mostly = {
60 .len = BUS_ID_SIZE-1 }, 60 .len = BUS_ID_SIZE-1 },
61 [NL80211_ATTR_WIPHY_TXQ_PARAMS] = { .type = NLA_NESTED }, 61 [NL80211_ATTR_WIPHY_TXQ_PARAMS] = { .type = NLA_NESTED },
62 [NL80211_ATTR_WIPHY_FREQ] = { .type = NLA_U32 }, 62 [NL80211_ATTR_WIPHY_FREQ] = { .type = NLA_U32 },
63 [NL80211_ATTR_WIPHY_SEC_CHAN_OFFSET] = { .type = NLA_U32 }, 63 [NL80211_ATTR_WIPHY_CHANNEL_TYPE] = { .type = NLA_U32 },
64 64
65 [NL80211_ATTR_IFTYPE] = { .type = NLA_U32 }, 65 [NL80211_ATTR_IFTYPE] = { .type = NLA_U32 },
66 [NL80211_ATTR_IFINDEX] = { .type = NLA_U32 }, 66 [NL80211_ATTR_IFINDEX] = { .type = NLA_U32 },
@@ -362,8 +362,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
362 } 362 }
363 363
364 if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) { 364 if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) {
365 enum nl80211_sec_chan_offset sec_chan_offset = 365 enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT;
366 NL80211_SEC_CHAN_NO_HT;
367 struct ieee80211_channel *chan; 366 struct ieee80211_channel *chan;
368 struct ieee80211_sta_ht_cap *ht_cap; 367 struct ieee80211_sta_ht_cap *ht_cap;
369 u32 freq, sec_freq; 368 u32 freq, sec_freq;
@@ -375,13 +374,13 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
375 374
376 result = -EINVAL; 375 result = -EINVAL;
377 376
378 if (info->attrs[NL80211_ATTR_WIPHY_SEC_CHAN_OFFSET]) { 377 if (info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]) {
379 sec_chan_offset = nla_get_u32(info->attrs[ 378 channel_type = nla_get_u32(info->attrs[
380 NL80211_ATTR_WIPHY_SEC_CHAN_OFFSET]); 379 NL80211_ATTR_WIPHY_CHANNEL_TYPE]);
381 if (sec_chan_offset != NL80211_SEC_CHAN_NO_HT && 380 if (channel_type != NL80211_CHAN_NO_HT &&
382 sec_chan_offset != NL80211_SEC_CHAN_DISABLED && 381 channel_type != NL80211_CHAN_HT20 &&
383 sec_chan_offset != NL80211_SEC_CHAN_BELOW && 382 channel_type != NL80211_CHAN_HT40PLUS &&
384 sec_chan_offset != NL80211_SEC_CHAN_ABOVE) 383 channel_type != NL80211_CHAN_HT40MINUS)
385 goto bad_res; 384 goto bad_res;
386 } 385 }
387 386
@@ -392,9 +391,9 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
392 if (!chan || chan->flags & IEEE80211_CHAN_DISABLED) 391 if (!chan || chan->flags & IEEE80211_CHAN_DISABLED)
393 goto bad_res; 392 goto bad_res;
394 393
395 if (sec_chan_offset == NL80211_SEC_CHAN_BELOW) 394 if (channel_type == NL80211_CHAN_HT40MINUS)
396 sec_freq = freq - 20; 395 sec_freq = freq - 20;
397 else if (sec_chan_offset == NL80211_SEC_CHAN_ABOVE) 396 else if (channel_type == NL80211_CHAN_HT40PLUS)
398 sec_freq = freq + 20; 397 sec_freq = freq + 20;
399 else 398 else
400 sec_freq = 0; 399 sec_freq = 0;
@@ -402,7 +401,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
402 ht_cap = &rdev->wiphy.bands[chan->band]->ht_cap; 401 ht_cap = &rdev->wiphy.bands[chan->band]->ht_cap;
403 402
404 /* no HT capabilities */ 403 /* no HT capabilities */
405 if (sec_chan_offset != NL80211_SEC_CHAN_NO_HT && 404 if (channel_type != NL80211_CHAN_NO_HT &&
406 !ht_cap->ht_supported) 405 !ht_cap->ht_supported)
407 goto bad_res; 406 goto bad_res;
408 407
@@ -422,7 +421,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
422 } 421 }
423 422
424 result = rdev->ops->set_channel(&rdev->wiphy, chan, 423 result = rdev->ops->set_channel(&rdev->wiphy, chan,
425 sec_chan_offset); 424 channel_type);
426 if (result) 425 if (result)
427 goto bad_res; 426 goto bad_res;
428 } 427 }