From patchwork Thu Dec 15 22:32:08 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Young X-Patchwork-Id: 131762 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "maxx.shmoo.com", Issuer "CA Cert Signing Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id A7685B70B1 for ; Fri, 16 Dec 2011 09:32:28 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 5CDDB9C16E; Thu, 15 Dec 2011 17:32:26 -0500 (EST) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id N6mxmhQ+YN-N; Thu, 15 Dec 2011 17:32:26 -0500 (EST) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 230299C1DC; Thu, 15 Dec 2011 17:32:21 -0500 (EST) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 884939C1DC for ; Thu, 15 Dec 2011 17:32:19 -0500 (EST) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nn5m7UmEuAwu for ; Thu, 15 Dec 2011 17:32:15 -0500 (EST) Received: from mail-vw0-f44.google.com (mail-vw0-f44.google.com [209.85.212.44]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (not verified)) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id B667E9C16E for ; Thu, 15 Dec 2011 17:32:15 -0500 (EST) Received: by vbbfo1 with SMTP id fo1so1433624vbb.17 for ; Thu, 15 Dec 2011 14:32:15 -0800 (PST) Received: by 10.52.65.1 with SMTP id t1mr4424621vds.121.1323988334578; Thu, 15 Dec 2011 14:32:14 -0800 (PST) Received: from dspg.com (173-14-65-235-Sacramento.hfc.comcastbusiness.net. [173.14.65.235]) by mx.google.com with ESMTPS id s10sm7257742vdj.1.2011.12.15.14.32.11 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 15 Dec 2011 14:32:13 -0800 (PST) Received: by dspg.com (sSMTP sendmail emulation); Thu, 15 Dec 2011 14:32:09 -0800 From: Jason Young To: hostap@lists.shmoo.com Subject: [PATCH] AP: Pass station's wmm configuration to driver wrappers Date: Thu, 15 Dec 2011 14:32:08 -0800 Message-Id: <1323988328-11485-1-git-send-email-jason.young@dspg.com> X-Mailer: git-send-email 1.7.5.4 Cc: Jason Young X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com This adds support for stations configuring uapsd queues and max_sp during (re)association. Signed-hostap: Jason Young --- src/ap/ap_drv_ops.c | 3 ++- src/ap/ap_drv_ops.h | 2 +- src/ap/ieee802_11.c | 10 +++++++--- src/ap/sta_info.h | 1 + src/common/ieee802_11_defs.h | 4 ++++ src/drivers/driver.h | 1 + src/drivers/driver_nl80211.c | 16 +++++++++++++++- 7 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c index 9419440..429c187 100644 --- a/src/ap/ap_drv_ops.c +++ b/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 qosinfo) { struct hostapd_sta_add_params params; @@ -336,6 +336,7 @@ 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.qosinfo = qosinfo; return hapd->driver->sta_add(hapd->drv_priv, ¶ms); } diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h index 477a1b7..835cdde 100644 --- a/src/ap/ap_drv_ops.h +++ b/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 qosinfo); 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 617a035..54f697c 100644 --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c @@ -551,15 +551,18 @@ static u16 check_wmm(struct hostapd_data *hapd, struct sta_info *sta, const u8 *wmm_ie, size_t wmm_ie_len) { sta->flags &= ~WLAN_STA_WMM; + sta->qosinfo = 0; if (wmm_ie && hapd->conf->wmm_enabled) { - if (hostapd_eid_wmm_valid(hapd, wmm_ie, wmm_ie_len)) + 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 + } else { sta->flags |= WLAN_STA_WMM; + sta->qosinfo = wmm_ie[6]; + } } return WLAN_STATUS_SUCCESS; } @@ -1562,7 +1565,8 @@ 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->qosinfo)) { 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 4d3b5e9..daa96bf 100644 --- a/src/ap/sta_info.h +++ b/src/ap/sta_info.h @@ -52,6 +52,7 @@ struct sta_info { u16 listen_interval; /* or beacon_int for APs */ u8 supported_rates[WLAN_SUPP_RATES_MAX]; int supported_rates_len; + u8 qosinfo; /* Valid when WLAN_STA_WMM is set */ unsigned int nonerp_set:1; unsigned int no_short_slot_time_set:1; diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h index 3014762..66801fd 100644 --- a/src/common/ieee802_11_defs.h +++ b/src/common/ieee802_11_defs.h @@ -677,6 +677,10 @@ struct wmm_information_element { } STRUCT_PACKED; +#define WMM_QOSINFO_STA_AC_MASK 0x0f +#define WMM_QOSINFO_STA_SP_MASK 0x03 +#define WMM_QOSINFO_STA_SP_SHIFT 5 + #define WMM_AC_AIFSN_MASK 0x0f #define WMM_AC_AIFNS_SHIFT 0 #define WMM_AC_ACM 0x10 diff --git a/src/drivers/driver.h b/src/drivers/driver.h index 76c4e8c..9a773ec 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -832,6 +832,7 @@ 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 qosinfo; }; struct hostapd_freq_params { diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index f17a61e..6e358b5 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -5361,7 +5361,7 @@ static int wpa_driver_nl80211_sta_add(void *priv, { struct i802_bss *bss = priv; struct wpa_driver_nl80211_data *drv = bss->drv; - struct nl_msg *msg; + struct nl_msg *msg, *wme = NULL; struct nl80211_sta_flag_update upd; int ret = -ENOBUFS; @@ -5390,6 +5390,19 @@ static int wpa_driver_nl80211_sta_add(void *priv, sizeof(*params->ht_capabilities), params->ht_capabilities); } + if (params->flags & WPA_STA_WMM) { + wme = nlmsg_alloc(); + if (!wme) + goto nla_put_failure; + + NLA_PUT_U8(wme, NL80211_STA_WME_UAPSD_QUEUES, + params->qosinfo & WMM_QOSINFO_STA_AC_MASK); + NLA_PUT_U8(wme, NL80211_STA_WME_MAX_SP, + (params->qosinfo > WMM_QOSINFO_STA_SP_SHIFT) & + WMM_QOSINFO_STA_SP_MASK); + + nla_put_nested(msg, NL80211_ATTR_STA_WME, wme); + } os_memset(&upd, 0, sizeof(upd)); upd.mask = sta_flags_nl80211(params->flags); @@ -5405,6 +5418,7 @@ static int wpa_driver_nl80211_sta_add(void *priv, if (ret == -EEXIST) ret = 0; nla_put_failure: + nlmsg_free(wme); nlmsg_free(msg); return ret; }