From abb8d08b8ab1d85335b5b6af691d2a5cb7e357d3 Mon Sep 17 00:00:00 2001 From: Eliad Peller Date: Tue, 17 Feb 2015 21:35:13 -0500 Subject: [PATCH] nl80211: Add support for configuring P2P GO CTWindow 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 --- src/drivers/driver_nl80211.c | 15 +++++++++++++++ src/drivers/driver_nl80211.h | 1 + src/drivers/driver_nl80211_capa.c | 5 +++++ 3 files changed, 21 insertions(+) diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index ee6d06947..2c4c0b365 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -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)", diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h index f19ac2921..802589aa7 100644 --- a/src/drivers/driver_nl80211.h +++ b/src/drivers/driver_nl80211.h @@ -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; diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c index e86743961..e0d1d233e 100644 --- a/src/drivers/driver_nl80211_capa.c +++ b/src/drivers/driver_nl80211_capa.c @@ -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;