diff options
author | Eliad Peller <eliad@wizery.com> | 2011-08-23 07:37:46 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-08-26 10:47:56 -0400 |
commit | c75786c9ef9e726dc139325a775e90a684b00ed7 (patch) | |
tree | 90ea19402f4f63217f79410a2909c0c943851927 | |
parent | a21fa87e3a3a8390f17f53967baa574f4e1e1e76 (diff) |
nl80211/cfg80211: add STA WME parameters
Add new NL80211_ATTR_STA_WME nested attribute that contains
wme params needed by the low-level driver (uapsd_queues and
max_sp).
Add these params to the station_parameters struct as well.
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | include/linux/nl80211.h | 23 | ||||
-rw-r--r-- | include/net/cfg80211.h | 2 | ||||
-rw-r--r-- | net/wireless/nl80211.c | 27 |
3 files changed, 52 insertions, 0 deletions
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h index 3769303d6fa6..0343504082a8 100644 --- a/include/linux/nl80211.h +++ b/include/linux/nl80211.h | |||
@@ -1042,6 +1042,9 @@ enum nl80211_commands { | |||
1042 | * (Re)Association Response frames when the driver (or firmware) replies to | 1042 | * (Re)Association Response frames when the driver (or firmware) replies to |
1043 | * (Re)Association Request frames. | 1043 | * (Re)Association Request frames. |
1044 | * | 1044 | * |
1045 | * @NL80211_ATTR_STA_WME: Nested attribute containing the wme configuration | ||
1046 | * of the station, see &enum nl80211_sta_wme_attr. | ||
1047 | * | ||
1045 | * @NL80211_ATTR_MAX: highest attribute number currently defined | 1048 | * @NL80211_ATTR_MAX: highest attribute number currently defined |
1046 | * @__NL80211_ATTR_AFTER_LAST: internal use | 1049 | * @__NL80211_ATTR_AFTER_LAST: internal use |
1047 | */ | 1050 | */ |
@@ -1252,6 +1255,8 @@ enum nl80211_attrs { | |||
1252 | NL80211_ATTR_IE_PROBE_RESP, | 1255 | NL80211_ATTR_IE_PROBE_RESP, |
1253 | NL80211_ATTR_IE_ASSOC_RESP, | 1256 | NL80211_ATTR_IE_ASSOC_RESP, |
1254 | 1257 | ||
1258 | NL80211_ATTR_STA_WME, | ||
1259 | |||
1255 | /* add attributes here, update the policy in nl80211.c */ | 1260 | /* add attributes here, update the policy in nl80211.c */ |
1256 | 1261 | ||
1257 | __NL80211_ATTR_AFTER_LAST, | 1262 | __NL80211_ATTR_AFTER_LAST, |
@@ -2482,4 +2487,22 @@ enum nl80211_hidden_ssid { | |||
2482 | NL80211_HIDDEN_SSID_ZERO_CONTENTS | 2487 | NL80211_HIDDEN_SSID_ZERO_CONTENTS |
2483 | }; | 2488 | }; |
2484 | 2489 | ||
2490 | /** | ||
2491 | * enum nl80211_sta_wme_attr - station WME attributes | ||
2492 | * @__NL80211_STA_WME_INVALID: invalid number for nested attribute | ||
2493 | * @NL80211_STA_WME_QUEUES: bitmap of uapsd queues. | ||
2494 | * @NL80211_STA_WME_MAX_SP: max service period. | ||
2495 | * @__NL80211_STA_WME_AFTER_LAST: internal | ||
2496 | * @NL80211_STA_WME_MAX: highest station WME attribute | ||
2497 | */ | ||
2498 | enum nl80211_sta_wme_attr { | ||
2499 | __NL80211_STA_WME_INVALID, | ||
2500 | NL80211_STA_WME_UAPSD_QUEUES, | ||
2501 | NL80211_STA_WME_MAX_SP, | ||
2502 | |||
2503 | /* keep last */ | ||
2504 | __NL80211_STA_WME_AFTER_LAST, | ||
2505 | NL80211_STA_WME_MAX = __NL80211_STA_WME_AFTER_LAST - 1 | ||
2506 | }; | ||
2507 | |||
2485 | #endif /* __LINUX_NL80211_H */ | 2508 | #endif /* __LINUX_NL80211_H */ |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 77aa777c10ef..88112ca59c8e 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -452,6 +452,8 @@ struct station_parameters { | |||
452 | u8 plink_action; | 452 | u8 plink_action; |
453 | u8 plink_state; | 453 | u8 plink_state; |
454 | struct ieee80211_ht_cap *ht_capa; | 454 | struct ieee80211_ht_cap *ht_capa; |
455 | u8 uapsd_queues; | ||
456 | u8 max_sp; | ||
455 | }; | 457 | }; |
456 | 458 | ||
457 | /** | 459 | /** |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 57ecfa4ad3b8..bddb5595c659 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -2545,6 +2545,12 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info) | |||
2545 | return err; | 2545 | return err; |
2546 | } | 2546 | } |
2547 | 2547 | ||
2548 | static struct nla_policy | ||
2549 | nl80211_sta_wme_policy[NL80211_STA_WME_MAX + 1] __read_mostly = { | ||
2550 | [NL80211_STA_WME_UAPSD_QUEUES] = { .type = NLA_U8 }, | ||
2551 | [NL80211_STA_WME_MAX_SP] = { .type = NLA_U8 }, | ||
2552 | }; | ||
2553 | |||
2548 | static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info) | 2554 | static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info) |
2549 | { | 2555 | { |
2550 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; | 2556 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; |
@@ -2590,6 +2596,27 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info) | |||
2590 | if (parse_station_flags(info, ¶ms)) | 2596 | if (parse_station_flags(info, ¶ms)) |
2591 | return -EINVAL; | 2597 | return -EINVAL; |
2592 | 2598 | ||
2599 | /* parse WME attributes if sta is WME capable */ | ||
2600 | if ((params.sta_flags_set & NL80211_STA_FLAG_WME) && | ||
2601 | info->attrs[NL80211_ATTR_STA_WME]) { | ||
2602 | struct nlattr *tb[NL80211_STA_WME_MAX + 1]; | ||
2603 | struct nlattr *nla; | ||
2604 | |||
2605 | nla = info->attrs[NL80211_ATTR_STA_WME]; | ||
2606 | err = nla_parse_nested(tb, NL80211_STA_WME_MAX, nla, | ||
2607 | nl80211_sta_wme_policy); | ||
2608 | if (err) | ||
2609 | return err; | ||
2610 | |||
2611 | if (tb[NL80211_STA_WME_UAPSD_QUEUES]) | ||
2612 | params.uapsd_queues = | ||
2613 | nla_get_u8(tb[NL80211_STA_WME_UAPSD_QUEUES]); | ||
2614 | |||
2615 | if (tb[NL80211_STA_WME_MAX_SP]) | ||
2616 | params.max_sp = | ||
2617 | nla_get_u8(tb[NL80211_STA_WME_MAX_SP]); | ||
2618 | } | ||
2619 | |||
2593 | if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && | 2620 | if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && |
2594 | dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN && | 2621 | dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN && |
2595 | dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT && | 2622 | dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT && |