]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
HT: Let the driver advertise its supported SMPS modes for AP mode
authorEliad Peller <eliad@wizery.com>
Mon, 20 Oct 2014 03:21:39 +0000 (23:21 -0400)
committerJouni Malinen <j@w1.fi>
Thu, 23 Oct 2014 22:25:29 +0000 (01:25 +0300)
Add smps_modes field, and let the driver fill it with its supported SMPS
modes (static/dynamic). This will let us start an AP with specific SMPS
mode (e.g., dynamic) that will allow it to reduce its power usage.

Signed-off-by: Eliad Peller <eliad@wizery.com>
hostapd/main.c
src/ap/hostapd.h
src/ap/hw_features.c
src/drivers/driver.h
wpa_supplicant/ap.c
wpa_supplicant/wpa_supplicant.c
wpa_supplicant/wpa_supplicant_i.h

index a9d91b9408de0187eb6452b3f5da018e5b3bba77..5a47711472680ac3efe9a6ecd24f9d3854c692fd 100644 (file)
@@ -213,6 +213,7 @@ static int hostapd_driver_init(struct hostapd_iface *iface)
        if (hapd->driver->get_capa &&
            hapd->driver->get_capa(hapd->drv_priv, &capa) == 0) {
                iface->drv_flags = capa.flags;
+               iface->smps_modes = capa.smps_modes;
                iface->probe_resp_offloads = capa.probe_resp_offloads;
                iface->extended_capa = capa.extended_capa;
                iface->extended_capa_mask = capa.extended_capa_mask;
index 50ebe0eff9eb87a649b317416b01c5991c31854d..be9d43a0e400f40610af00a1fb948e6248b22006 100644 (file)
@@ -296,6 +296,9 @@ struct hostapd_iface {
 
        unsigned int drv_flags;
 
+       /* SMPS modes supported by the driver (WPA_DRIVER_SMPS_MODE_*) */
+       unsigned int smps_modes;
+
        /*
         * A bitmap of supported protocols for probe response offload. See
         * struct wpa_driver_capa in driver.h
index 4e66d1b732a4d074b38dc1ae25d4cf33b55b366e..d7d5e83f8319a1b162c80fa9b319830957c388b6 100644 (file)
@@ -746,11 +746,24 @@ static int ieee80211n_supported_ht_capab(struct hostapd_iface *iface)
                return 0;
        }
 
-       if ((conf & HT_CAP_INFO_SMPS_MASK) != (hw & HT_CAP_INFO_SMPS_MASK) &&
-           (conf & HT_CAP_INFO_SMPS_MASK) != HT_CAP_INFO_SMPS_DISABLED) {
-               wpa_printf(MSG_ERROR, "Driver does not support configured "
-                          "HT capability [SMPS-*]");
-               return 0;
+       switch (conf & HT_CAP_INFO_SMPS_MASK) {
+       case HT_CAP_INFO_SMPS_STATIC:
+               if (!(iface->smps_modes & WPA_DRIVER_SMPS_MODE_STATIC)) {
+                       wpa_printf(MSG_ERROR,
+                                  "Driver does not support configured HT capability [SMPS-STATIC]");
+                       return 0;
+               }
+               break;
+       case HT_CAP_INFO_SMPS_DYNAMIC:
+               if (!(iface->smps_modes & WPA_DRIVER_SMPS_MODE_DYNAMIC)) {
+                       wpa_printf(MSG_ERROR,
+                                  "Driver does not support configured HT capability [SMPS-DYNAMIC]");
+                       return 0;
+               }
+               break;
+       case HT_CAP_INFO_SMPS_DISABLED:
+       default:
+               break;
        }
 
        if ((conf & HT_CAP_INFO_GREEN_FIELD) &&
index 7f1ee82e816c9a095c3f01de8e3b3a56009cfd92..5fecd04db1d8b9610d5e1c7f52a0d710274e91d8 100644 (file)
@@ -1056,6 +1056,10 @@ struct wpa_driver_capa {
 #define WPA_DRIVER_FLAGS_MESH                  0x0000000100000000ULL
        u64 flags;
 
+#define WPA_DRIVER_SMPS_MODE_STATIC                    0x00000001
+#define WPA_DRIVER_SMPS_MODE_DYNAMIC                   0x00000002
+       unsigned int smps_modes;
+
        int max_scan_ssids;
        int max_sched_scan_ssids;
        int sched_scan_supported;
index 7555c4265177cad59b40b386f8a570d281ca96d2..ec6e868719b6a9b7fdef6ebef573d35825aeec4b 100644 (file)
@@ -555,6 +555,7 @@ int wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s,
                return -1;
        hapd_iface->owner = wpa_s;
        hapd_iface->drv_flags = wpa_s->drv_flags;
+       hapd_iface->smps_modes = wpa_s->drv_smps_modes;
        hapd_iface->probe_resp_offloads = wpa_s->probe_resp_offloads;
        hapd_iface->extended_capa = wpa_s->extended_capa;
        hapd_iface->extended_capa_mask = wpa_s->extended_capa_mask;
index 044a964321b39c0b2aa8840170c4111c72a907fe..353a54dde3edfb35cb8e1cfd4f10b2d1daff2c0e 100644 (file)
@@ -3804,6 +3804,7 @@ static int wpa_supplicant_init_iface(struct wpa_supplicant *wpa_s,
                wpa_s->drv_capa_known = 1;
                wpa_s->drv_flags = capa.flags;
                wpa_s->drv_enc = capa.enc;
+               wpa_s->drv_smps_modes = capa.smps_modes;
                wpa_s->probe_resp_offloads = capa.probe_resp_offloads;
                wpa_s->max_scan_ssids = capa.max_scan_ssids;
                wpa_s->max_sched_scan_ssids = capa.max_sched_scan_ssids;
index 0adbeb06202d00bd6d382656025154f373c892d5..a0acf3ced837cc6c6850967489038909c7d04d9a 100644 (file)
@@ -574,6 +574,7 @@ struct wpa_supplicant {
 
        u64 drv_flags;
        unsigned int drv_enc;
+       unsigned int drv_smps_modes;
 
        /*
         * A bitmap of supported protocols for probe response offload. See