Browse Source

AP: Add uapsd_queues and max_sp fields

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>
Eliad Peller 13 years ago
parent
commit
5f32f79c6e
5 changed files with 22 additions and 6 deletions
  1. 3 1
      src/ap/ap_drv_ops.c
  2. 1 1
      src/ap/ap_drv_ops.h
  3. 13 4
      src/ap/ieee802_11.c
  4. 3 0
      src/ap/sta_info.h
  5. 2 0
      src/drivers/driver.h

+ 3 - 1
src/ap/ap_drv_ops.c

@@ -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);
 }
 

+ 1 - 1
src/ap/ap_drv_ops.h

@@ -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);

+ 13 - 4
src/ap/ieee802_11.c

@@ -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");

+ 3 - 0
src/ap/sta_info.h

@@ -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];
 

+ 2 - 0
src/drivers/driver.h

@@ -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 {