]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
wpa_supplicant AP/P2P: Enable WMM param configuration
authorYoni Divinsky <yoni.divinsky@ti.com>
Sun, 12 Aug 2012 08:34:07 +0000 (11:34 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 12 Aug 2012 08:34:07 +0000 (11:34 +0300)
In case of P2P GO and AP mode, wpa_supplicant uses the default hostapd
parameters for WMM. In the default parameters the ACM bit for video and
voice are set to 1, meaning, P2P devices and stations which are
connected to the GO cannot pass voice or video data packets. Allow this
to be changed through wpa_supplicant configuration file with wmm_ac_*
parameters.

Signed-hostap: Yoni Divinsky <yoni.divinsky@ti.com>

wpa_supplicant/ap.c
wpa_supplicant/config.c
wpa_supplicant/config.h

index 80c1783cce21a3c90093ef4d0c5a6c933d7e017f..617948293c4e9f82ada9e9c43dd9d5ffd38b8e8f 100644 (file)
@@ -490,6 +490,10 @@ int wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s,
                return -1;
        }
 
+       os_memcpy(wpa_s->ap_iface->conf->wmm_ac_params,
+                 wpa_s->conf->wmm_ac_params,
+                 sizeof(wpa_s->conf->wmm_ac_params));
+
        if (params.uapsd > 0) {
                conf->bss->wmm_enabled = 1;
                conf->bss->wmm_uapsd = 1;
index de7e528e6c2c994a17eef261f47ea8047a50c6ad..fe8c727e20916f714c4553df981751d7d845349a 100644 (file)
@@ -2549,6 +2549,15 @@ struct wpa_config * wpa_config_alloc_empty(const char *ctrl_interface,
                                           const char *driver_param)
 {
        struct wpa_config *config;
+       const int aCWmin = 4, aCWmax = 10;
+       const struct hostapd_wmm_ac_params ac_bk =
+               { aCWmin, aCWmax, 7, 0, 0 }; /* background traffic */
+       const struct hostapd_wmm_ac_params ac_be =
+               { aCWmin, aCWmax, 3, 0, 0 }; /* best effort traffic */
+       const struct hostapd_wmm_ac_params ac_vi = /* video traffic */
+               { aCWmin - 1, aCWmin, 2, 3000 / 32, 1 };
+       const struct hostapd_wmm_ac_params ac_vo = /* voice traffic */
+               { aCWmin - 2, aCWmin - 1, 2, 1500 / 32, 1 };
 
        config = os_zalloc(sizeof(*config));
        if (config == NULL)
@@ -2564,6 +2573,10 @@ struct wpa_config * wpa_config_alloc_empty(const char *ctrl_interface,
        config->bss_expiration_scan_count = DEFAULT_BSS_EXPIRATION_SCAN_COUNT;
        config->max_num_sta = DEFAULT_MAX_NUM_STA;
        config->access_network_type = DEFAULT_ACCESS_NETWORK_TYPE;
+       config->wmm_ac_params[0] = ac_be;
+       config->wmm_ac_params[1] = ac_bk;
+       config->wmm_ac_params[2] = ac_vi;
+       config->wmm_ac_params[3] = ac_vo;
 
        if (ctrl_interface)
                config->ctrl_interface = os_strdup(ctrl_interface);
@@ -3021,6 +3034,25 @@ int wpa_config_process_global(struct wpa_config *config, char *pos, int line)
                break;
        }
        if (i == NUM_GLOBAL_FIELDS) {
+#ifdef CONFIG_AP
+               if (os_strncmp(pos, "wmm_ac_", 7) == 0) {
+                       char *tmp = os_strchr(pos, '=');
+                       if (tmp == NULL) {
+                               if (line < 0)
+                                       return -1;
+                               wpa_printf(MSG_ERROR, "Line %d: invalid line "
+                                          "'%s'", line, pos);
+                               return -1;
+                       }
+                       *tmp++ = '\0';
+                       if (hostapd_config_wmm_ac(config->wmm_ac_params, pos,
+                                                 tmp)) {
+                               wpa_printf(MSG_ERROR, "Line %d: invalid WMM "
+                                          "AC item", line);
+                               return -1;
+                       }
+               }
+#endif /* CONFIG_AP */
                if (line < 0)
                        return -1;
                wpa_printf(MSG_ERROR, "Line %d: unknown global field '%s'.",
index f163385eed7a3e911950230d39dc41aa4d6a671c..c3c90e2eb8932b8a418f515e51a92fec787039f6 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "config_ssid.h"
 #include "wps/wps.h"
+#include "common/ieee802_11_common.h"
 
 
 struct wpa_cred {
@@ -733,6 +734,8 @@ struct wpa_config {
         * By default: 300 seconds.
         */
        int p2p_go_max_inactivity;
+
+       struct hostapd_wmm_ac_params wmm_ac_params[4];
 };