From patchwork Sun Apr 8 18:35:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jouni Malinen X-Patchwork-Id: 151368 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 DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "maxx.shmoo.com", Issuer "CA Cert Signing Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id D2377B7037 for ; Mon, 9 Apr 2012 04:35:32 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 442129D27C; Sun, 8 Apr 2012 14:35:29 -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 bWLAJxsQNSjp; Sun, 8 Apr 2012 14:35:29 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 024149D27E; Sun, 8 Apr 2012 14:35:25 -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 5F0989D27E for ; Sun, 8 Apr 2012 14:35:23 -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 Z7Hn2vOy9XD9 for ; Sun, 8 Apr 2012 14:35:19 -0400 (EDT) Received: from jmaline2.user.openhosting.com (kvm.w1.fi [128.177.28.162]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id AB50B9D27C for ; Sun, 8 Apr 2012 14:35:19 -0400 (EDT) Received: from jm (a91-155-81-182.elisa-laajakaista.fi [91.155.81.182]) (authenticated bits=0) by jmaline2.user.openhosting.com (8.13.8/8.13.8) with ESMTP id q38IRp3s009402 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sun, 8 Apr 2012 14:27:53 -0400 Received: by jm (sSMTP sendmail emulation); Sun, 08 Apr 2012 21:35:16 +0300 Date: Sun, 8 Apr 2012 21:35:16 +0300 From: Jouni Malinen To: hostap@lists.shmoo.com Subject: Re: [RFC 1/4] P2P: Handling single channel concurrency Message-ID: <20120408183516.GB12438@w1.fi> Mail-Followup-To: hostap@lists.shmoo.com References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com On Tue, Mar 06, 2012 at 10:33:50AM +0530, Jithu Jance wrote: > diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c > @@ -3418,6 +3418,20 @@ static int p2p_ctrl_set(struct wpa_supplicant > + if (os_strcmp(cmd, "conc_priority") == 0) { > + if(os_strncmp(cmd+strlen("conc_priority")+1, "sta", 3) == 0) > + os_strncpy(wpa_s->global->conc_priority, "sta", 3); > + else if(os_strncmp(cmd+strlen("conc_priority")+1, "p2p", 3) == 0) > + os_strncpy(wpa_s->global->conc_priority, "p2p", 3); > + else { > + wpa_printf(MSG_ERROR, " conc_priority arg should be either sta or p2p"); > + return -1; > + } Is there any specific reason for storing this as a string instead of an integer or enum? A bit cleaned up version below. [PATCH 1/3] P2P: Add preference setting for concurrent use cases Add an additional parameter to prioritize either sta or p2p connection to resolve conflicts arising during single channel concurrency. Signed-hostap: Jithu Jance --- wpa_supplicant/ctrl_iface.c | 14 ++++++++++++++ wpa_supplicant/wpa_supplicant.c | 10 ++++++++++ wpa_supplicant/wpa_supplicant_i.h | 6 ++++++ 3 files changed, 30 insertions(+), 0 deletions(-) diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 3ddae95..07d3819 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -3576,6 +3576,20 @@ static int p2p_ctrl_set(struct wpa_supplicant *wpa_s, char *cmd) return 0; } + if (os_strcmp(cmd, "conc_pref") == 0) { + if (os_strcmp(param, "sta") == 0) + wpa_s->global->conc_pref = WPA_CONC_PREF_STA; + else if (os_strcmp(param, "p2p") == 0) + wpa_s->global->conc_pref = WPA_CONC_PREF_P2P; + else { + wpa_printf(MSG_INFO, "Invalid conc_pref value"); + return -1; + } + wpa_printf(MSG_DEBUG, "Single channel concurrency preference: " + "%s", param); + return 0; + } + if (os_strcmp(cmd, "force_long_sd") == 0) { wpa_s->force_long_sd = atoi(param); return 0; diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index c5a7115..1c88949 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -3216,3 +3216,13 @@ int wpas_driver_bss_selection(struct wpa_supplicant *wpa_s) return wpa_s->conf->ap_scan == 2 || (wpa_s->drv_flags & WPA_DRIVER_FLAGS_BSS_SELECTION); } + + +int wpas_is_p2p_prioritized(struct wpa_supplicant *wpa_s) +{ + if (wpa_s->global->conc_pref == WPA_CONC_PREF_P2P) + return 1; + if (wpa_s->global->conc_pref == WPA_CONC_PREF_STA) + return 0; + return -1; +} diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index a494c49..3f1f589 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -233,6 +233,11 @@ struct wpa_global { int cross_connection; struct wpa_freq_range *p2p_disallow_freq; unsigned int num_p2p_disallow_freq; + enum wpa_conc_pref { + WPA_CONC_PREF_NOT_SET, + WPA_CONC_PREF_STA, + WPA_CONC_PREF_P2P + } conc_pref; }; @@ -623,6 +628,7 @@ void wpa_supplicant_update_config(struct wpa_supplicant *wpa_s); void wpa_supplicant_clear_status(struct wpa_supplicant *wpa_s); void wpas_connection_failed(struct wpa_supplicant *wpa_s, const u8 *bssid); int wpas_driver_bss_selection(struct wpa_supplicant *wpa_s); +int wpas_is_p2p_prioritized(struct wpa_supplicant *wpa_s); /* events.c */ void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s);