nl80211: Add support for configuring P2P GO CTWindow
authorEliad Peller <eliad@wizery.com>
Wed, 18 Feb 2015 02:35:13 +0000 (21:35 -0500)
committerJouni Malinen <j@w1.fi>
Sat, 21 Feb 2015 14:07:53 +0000 (16:07 +0200)
Configure the GO CTWindow on APstart if the driver supports it and this
parameter is set in wpa_supplicant configuration.

Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
src/drivers/driver_nl80211.c
src/drivers/driver_nl80211.h
src/drivers/driver_nl80211_capa.c

index ee6d069..2c4c0b3 100644 (file)
@@ -3439,6 +3439,21 @@ static int wpa_driver_nl80211_set_ap(void *priv,
                        goto fail;
        }
 
+#ifdef CONFIG_P2P
+       if (params->p2p_go_ctwindow > 0) {
+               if (drv->p2p_go_ctwindow_supported) {
+                       wpa_printf(MSG_DEBUG, "nl80211: P2P GO ctwindow=%d",
+                                  params->p2p_go_ctwindow);
+                       if (nla_put_u8(msg, NL80211_ATTR_P2P_CTWINDOW,
+                                      params->p2p_go_ctwindow))
+                               goto fail;
+               } else {
+                       wpa_printf(MSG_INFO,
+                                  "nl80211: Driver does not support CTWindow configuration - ignore this parameter");
+               }
+       }
+#endif /* CONFIG_P2P */
+
        ret = send_and_recv_msgs(drv, msg, NULL, NULL);
        if (ret) {
                wpa_printf(MSG_DEBUG, "nl80211: Beacon set failed: %d (%s)",
index f19ac29..802589a 100644 (file)
@@ -144,6 +144,7 @@ struct wpa_driver_nl80211_data {
        unsigned int addr_changed:1;
        unsigned int get_features_vendor_cmd_avail:1;
        unsigned int set_rekey_offload:1;
+       unsigned int p2p_go_ctwindow_supported:1;
 
        u64 remain_on_chan_cookie;
        u64 send_action_cookie;
index e867439..e0d1d23 100644 (file)
@@ -71,6 +71,7 @@ struct wiphy_info_data {
        unsigned int connect_supported:1;
        unsigned int p2p_go_supported:1;
        unsigned int p2p_client_supported:1;
+       unsigned int p2p_go_ctwindow_supported:1;
        unsigned int p2p_concurrent:1;
        unsigned int channel_switch_supported:1;
        unsigned int set_qos_map_supported:1;
@@ -365,6 +366,9 @@ static void wiphy_info_feature_flags(struct wiphy_info_data *info,
                capa->flags |= WPA_DRIVER_FLAGS_TDLS_CHANNEL_SWITCH;
        }
 
+       if (flags & NL80211_FEATURE_P2P_GO_CTWIN)
+               info->p2p_go_ctwindow_supported = 1;
+
        if (flags & NL80211_FEATURE_LOW_PRIORITY_SCAN)
                info->have_low_prio_scan = 1;
 
@@ -827,6 +831,7 @@ int wpa_driver_nl80211_capa(struct wpa_driver_nl80211_data *drv)
        drv->device_ap_sme = info.device_ap_sme;
        drv->poll_command_supported = info.poll_command_supported;
        drv->data_tx_status = info.data_tx_status;
+       drv->p2p_go_ctwindow_supported = info.p2p_go_ctwindow_supported;
        if (info.set_qos_map_supported)
                drv->capa.flags |= WPA_DRIVER_FLAGS_QOS_MAPPING;
        drv->have_low_prio_scan = info.have_low_prio_scan;