[PATCH 3/3] driver_nl80211: advertise and configure smps modes

Ilan Peer ilan.peer at intel.com
Sun Oct 19 23:21:41 EDT 2014


From: Eliad Peller <eliad at wizery.com>

Advertise static/dynamic smps mode support (according
to the wiphy feature bits), and pass the configured smps_mode
when starting the ap.

Signed-off-by: Eliad Peller <eliad at wizery.com>
---
 src/drivers/driver_nl80211.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 85a072d..563126a 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -3818,6 +3818,12 @@ static void wiphy_info_feature_flags(struct wiphy_info_data *info,
 
 	if (flags & NL80211_FEATURE_LOW_PRIORITY_SCAN)
 		info->have_low_prio_scan = 1;
+
+	if (flags & NL80211_FEATURE_STATIC_SMPS)
+		capa->smps_modes |= WPA_DRIVER_SMPS_MODE_STATIC;
+
+	if (flags & NL80211_FEATURE_DYNAMIC_SMPS)
+		capa->smps_modes |= WPA_DRIVER_SMPS_MODE_DYNAMIC;
 }
 
 
@@ -7403,6 +7409,7 @@ static int wpa_driver_nl80211_set_ap(void *priv,
 	int beacon_set;
 	int ifindex = if_nametoindex(bss->ifname);
 	int num_suites;
+	int smps_mode;
 	u32 suites[10], suite;
 	u32 ver;
 
@@ -7511,6 +7518,24 @@ static int wpa_driver_nl80211_set_ap(void *priv,
 	if (suite)
 		NLA_PUT_U32(msg, NL80211_ATTR_CIPHER_SUITE_GROUP, suite);
 
+	switch (params->smps_mode) {
+	case HT_CAP_INFO_SMPS_DYNAMIC:
+		wpa_printf(MSG_DEBUG, "nl80211: smps mode - dynamic");
+		smps_mode = NL80211_SMPS_DYNAMIC;
+		break;
+	case HT_CAP_INFO_SMPS_STATIC:
+		wpa_printf(MSG_DEBUG, "nl80211: smps mode - static");
+		smps_mode = NL80211_SMPS_STATIC;
+		break;
+	default:
+		/* invalid - fallback to smps off */
+	case HT_CAP_INFO_SMPS_DISABLED:
+		wpa_printf(MSG_DEBUG, "nl80211: smps mode - off");
+		smps_mode = NL80211_SMPS_OFF;
+		break;
+	}
+	NLA_PUT_U32(msg, NL80211_ATTR_SMPS_MODE, smps_mode);
+
 	if (params->beacon_ies) {
 		wpa_hexdump_buf(MSG_DEBUG, "nl80211: beacon_ies",
 				params->beacon_ies);
-- 
1.8.3.2



More information about the HostAP mailing list