AP: Add uapsd_queues and max_sp fields
authorEliad Peller <eliad@wizery.com>
Sat, 17 Dec 2011 09:55:14 +0000 (11:55 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 17 Dec 2011 09:55:14 +0000 (11:55 +0200)
Add uapsd_queues and max_sp fields to sta_info struct,
and pass them to the sta_add callback.

These values are determined by the WMM IE in the (Re)Association Request.

Signed-off-by: Eliad Peller <eliad@wizery.com>
src/ap/ap_drv_ops.c
src/ap/ap_drv_ops.h
src/ap/ieee802_11.c
src/ap/sta_info.h
src/drivers/driver.h

index 9419440..9bc01db 100644 (file)
@@ -318,7 +318,7 @@ int hostapd_sta_add(struct hostapd_data *hapd,
                    const u8 *supp_rates, size_t supp_rates_len,
                    u16 listen_interval,
                    const struct ieee80211_ht_capabilities *ht_capab,
-                   u32 flags)
+                   u32 flags, u8 uapsd_queues, u8 max_sp)
 {
        struct hostapd_sta_add_params params;
 
@@ -336,6 +336,8 @@ int hostapd_sta_add(struct hostapd_data *hapd,
        params.listen_interval = listen_interval;
        params.ht_capabilities = ht_capab;
        params.flags = hostapd_sta_flags_to_drv(flags);
+       params.uapsd_queues = uapsd_queues;
+       params.max_sp = max_sp;
        return hapd->driver->sta_add(hapd->drv_priv, &params);
 }
 
index 477a1b7..ad22308 100644 (file)
@@ -43,7 +43,7 @@ int hostapd_sta_add(struct hostapd_data *hapd,
                    const u8 *supp_rates, size_t supp_rates_len,
                    u16 listen_interval,
                    const struct ieee80211_ht_capabilities *ht_capab,
-                   u32 flags);
+                   u32 flags, u8 uapsd_queues, u8 max_sp);
 int hostapd_set_privacy(struct hostapd_data *hapd, int enabled);
 int hostapd_set_generic_elem(struct hostapd_data *hapd, const u8 *elem,
                             size_t elem_len);
index 617a035..8b5a45f 100644 (file)
@@ -552,14 +552,23 @@ static u16 check_wmm(struct hostapd_data *hapd, struct sta_info *sta,
 {
        sta->flags &= ~WLAN_STA_WMM;
        if (wmm_ie && hapd->conf->wmm_enabled) {
-               if (hostapd_eid_wmm_valid(hapd, wmm_ie, wmm_ie_len))
+               struct wmm_information_element *wmm;
+               u8 qos_info;
+
+               if (hostapd_eid_wmm_valid(hapd, wmm_ie, wmm_ie_len)) {
                        hostapd_logger(hapd, sta->addr,
                                       HOSTAPD_MODULE_WPA,
                                       HOSTAPD_LEVEL_DEBUG,
                                       "invalid WMM element in association "
                                       "request");
-               else
-                       sta->flags |= WLAN_STA_WMM;
+                       return WLAN_STATUS_UNSPECIFIED_FAILURE;
+               }
+
+               sta->flags |= WLAN_STA_WMM;
+               wmm = (struct wmm_information_element *) wmm_ie;
+               qos_info = wmm->qos_info;
+               sta->uapsd_queues = qos_info & 0xf;
+               sta->max_sp = qos_info >> 5;
        }
        return WLAN_STATUS_SUCCESS;
 }
@@ -1562,7 +1571,7 @@ static void handle_assoc_cb(struct hostapd_data *hapd,
                            sta->supported_rates, sta->supported_rates_len,
                            sta->listen_interval,
                            sta->flags & WLAN_STA_HT ? &ht_cap : NULL,
-                           sta->flags)) {
+                           sta->flags, sta->uapsd_queues, sta->max_sp)) {
                hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
                               HOSTAPD_LEVEL_NOTICE,
                               "Could not add STA to kernel driver");
index 4d3b5e9..f874270 100644 (file)
@@ -61,6 +61,9 @@ struct sta_info {
        unsigned int ht_20mhz_set:1;
        unsigned int no_p2p_set:1;
 
+       u8 uapsd_queues;
+       u8 max_sp;
+
        u16 auth_alg;
        u8 previous_ap[6];
 
index 98d82e6..783102e 100644 (file)
@@ -834,6 +834,8 @@ struct hostapd_sta_add_params {
        const struct ieee80211_ht_capabilities *ht_capabilities;
        u32 flags; /* bitmask of WPA_STA_* flags */
        int set; /* Set STA parameters instead of add */
+       u8 uapsd_queues;
+       u8 max_sp;
 };
 
 struct hostapd_freq_params {