[PATCH 1/3] HT: let the driver advertise its supported smps modes
Ilan Peer
ilan.peer
Sun Oct 19 20:21:39 PDT 2014
From: Eliad Peller <eliad at wizery.com>
Add smps_modes field, and let the driver fill it
with its supported smps mode (static/dynamic)
Finally, 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 at wizery.com>
---
hostapd/main.c | 1 +
src/ap/hostapd.h | 3 +++
src/ap/hw_features.c | 23 ++++++++++++++++++-----
src/drivers/driver.h | 4 ++++
wpa_supplicant/ap.c | 1 +
wpa_supplicant/wpa_supplicant.c | 1 +
wpa_supplicant/wpa_supplicant_i.h | 1 +
7 files changed, 29 insertions(+), 5 deletions(-)
diff --git a/hostapd/main.c b/hostapd/main.c
index a9d91b9..5a47711 100644
--- a/hostapd/main.c
+++ b/hostapd/main.c
@@ -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;
diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h
index ca01a68..3bd111e 100644
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -293,6 +293,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
diff --git a/src/ap/hw_features.c b/src/ap/hw_features.c
index 4e66d1b..6796885 100644
--- a/src/ap/hw_features.c
+++ b/src/ap/hw_features.c
@@ -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) &&
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index ad9d080..9b67136 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -1048,6 +1048,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;
diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c
index 7555c42..ec6e868 100644
--- a/wpa_supplicant/ap.c
+++ b/wpa_supplicant/ap.c
@@ -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;
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index b05eb86..58aff9c 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -3788,6 +3788,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;
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index 5ad283d..1d390ad 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -573,6 +573,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
--
1.8.3.2
More information about the Hostap
mailing list