[PATCH 2/3] hostapd: add uapsd_queues and max_sp fields

Eliad Peller eliad at wizery.com
Wed Aug 31 06:30:29 EDT 2011


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 WME ie in the assoc request.

Signed-off-by: Eliad Peller <eliad at wizery.com>
---
 src/ap/ap_drv_ops.c  |    4 +++-
 src/ap/ap_drv_ops.h  |    2 +-
 src/ap/ieee802_11.c  |   17 +++++++++++++----
 src/ap/sta_info.h    |    3 +++
 src/drivers/driver.h |    2 ++
 5 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
index 2860b57..d020f5a 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -337,7 +337,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;
 
@@ -355,6 +355,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);
 }
 
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
index 115099d..9d06eb9 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
@@ -44,7 +44,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);
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index e5a0a85..ccc802a 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -593,14 +593,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;
 }
@@ -1710,7 +1719,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");
diff --git a/src/ap/sta_info.h b/src/ap/sta_info.h
index c5e916f..6308523 100644
--- a/src/ap/sta_info.h
+++ b/src/ap/sta_info.h
@@ -59,6 +59,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];
 
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 54e2ef3..1f3955e 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -717,6 +717,8 @@ struct hostapd_sta_add_params {
 	u16 listen_interval;
 	const struct ieee80211_ht_capabilities *ht_capabilities;
 	u32 flags; /* bitmask of WPA_STA_* flags */
+	u8 uapsd_queues;
+	u8 max_sp;
 };
 
 struct hostapd_freq_params {
-- 
1.7.0.4



More information about the HostAP mailing list