From patchwork Mon May 19 07:07:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilan Peer X-Patchwork-Id: 350141 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 106AB14008B for ; Mon, 19 May 2014 18:13:21 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 8CB429D30C; Mon, 19 May 2014 04:13:12 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Fnqi+8TFESrp; Mon, 19 May 2014 04:13:12 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 0F4739D23D; Mon, 19 May 2014 04:08:58 -0400 (EDT) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id B12579D22A for ; Mon, 19 May 2014 04:08:56 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wTFsWva3tkMF for ; Mon, 19 May 2014 04:08:50 -0400 (EDT) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id B85D49D23D for ; Mon, 19 May 2014 04:04:23 -0400 (EDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 19 May 2014 01:04:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.98,865,1392192000"; d="scan'208";a="541275047" Received: from unknown (HELO ipeer-e6430-1.jer.intel.com) ([10.12.217.172]) by fmsmga002.fm.intel.com with ESMTP; 19 May 2014 01:03:51 -0700 From: Ilan Peer To: hostap@lists.shmoo.com Subject: [PATCH 09/14] wpa_supplicant: Implement P2P_GO_FREQ_MOVE_SCM_ECSA policy Date: Mon, 19 May 2014 10:07:11 +0300 Message-Id: <1400483236-10320-10-git-send-email-ilan.peer@intel.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1400483236-10320-1-git-send-email-ilan.peer@intel.com> References: <1400483236-10320-1-git-send-email-ilan.peer@intel.com> X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.11 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com From: Andrei Otcheretianski Add new GO frequency move policy. The P2P_GO_FREQ_MOVE_SCM_ECSA prefers SCM if all the clients advertise eCSA support and the candidate frequency is one of the group common frequencies. Signed-off-by: Andrei Otcheretianski --- src/ap/ieee802_11.c | 3 +++ src/ap/sta_info.h | 1 + wpa_supplicant/config.h | 7 ++++++- wpa_supplicant/p2p_supplicant.c | 29 +++++++++++++++++++++++++++++ 4 files changed, 39 insertions(+), 1 deletion(-) diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c index 3ddb1ee..41b56c8 100644 --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c @@ -868,6 +868,9 @@ static u16 check_ext_capab(struct hostapd_data *hapd, struct sta_info *sta, } #endif /* CONFIG_INTERWORKING */ + if (ext_capab_ie_len > 0) + sta->ecsa_supported = !!(ext_capab_ie[0] & BIT(2)); + return WLAN_STATUS_SUCCESS; } diff --git a/src/ap/sta_info.h b/src/ap/sta_info.h index 03db98f..6a7a69a 100644 --- a/src/ap/sta_info.h +++ b/src/ap/sta_info.h @@ -60,6 +60,7 @@ struct sta_info { unsigned int qos_map_enabled:1; unsigned int remediation:1; unsigned int hs20_deauth_requested:1; + unsigned int ecsa_supported:1; u16 auth_alg; diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h index ed07cca..771b2ed 100644 --- a/wpa_supplicant/config.h +++ b/wpa_supplicant/config.h @@ -734,12 +734,17 @@ struct wpa_config { * frequency list of the local device and the peer device. * * @P2P_GO_FREQ_MOVE_STAY: prefer to stay on the current frequency. + * + * @P2P_GO_FREQ_MOVE_SCM_ECSA: same as + * P2P_GO_FREQ_MOVE_SCM_PEER_SUPPORTS but a transition is possible only + * if all peers advertise eCSA support. */ enum { P2P_GO_FREQ_MOVE_SCM = 0, P2P_GO_FREQ_MOVE_SCM_PEER_SUPPORTS = 1, P2P_GO_FREQ_MOVE_STAY = 2, - P2P_GO_FREQ_MOVE_MAX = P2P_GO_FREQ_MOVE_STAY, + P2P_GO_FREQ_MOVE_SCM_ECSA = 3, + P2P_GO_FREQ_MOVE_MAX = P2P_GO_FREQ_MOVE_SCM_ECSA, } p2p_go_freq_change_policy; diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 22ba344..ab328f4 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -3029,6 +3029,29 @@ static int wpas_p2p_go_is_peer_freq(struct wpa_supplicant *wpa_s, int freq) } +static int wpas_sta_check_ecsa(struct hostapd_data *hapd, + struct sta_info *sta, void *ctx) +{ + int *ecsa_support = ctx; + + *ecsa_support &= sta->ecsa_supported; + + return 0; +} + +/* + * Check if all the peers support eCSA + */ +static int wpas_p2p_go_peers_support_ecsa(struct wpa_supplicant *wpa_s) +{ + int ecsa_support = 1; + + ap_for_each_sta(wpa_s->ap_iface->bss[0], wpas_sta_check_ecsa, + &ecsa_support); + + return ecsa_support; +} + static int wpas_freq_included(struct wpa_supplicant *wpa_s, const struct p2p_channels *channels, unsigned int freq) @@ -8365,6 +8388,12 @@ static void wpas_p2p_consider_moving_one_go(struct wpa_supplicant *wpa_s, P2P_GO_FREQ_MOVE_SCM_PEER_SUPPORTS) && wpas_p2p_go_is_peer_freq(wpa_s, freqs[i].freq)) { policy_move = 1; + } else if ((wpa_s->conf->p2p_go_freq_change_policy == + P2P_GO_FREQ_MOVE_SCM_ECSA) && + wpa_s->csa_supported && + wpas_p2p_go_is_peer_freq(wpa_s, freqs[i].freq) && + wpas_p2p_go_peers_support_ecsa(wpa_s)) { + policy_move = 1; } }