From patchwork Tue Mar 6 05:03:50 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jithu Jance X-Patchwork-Id: 144839 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 149DCB6EEC for ; Tue, 6 Mar 2012 16:04:06 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 121C99D235; Tue, 6 Mar 2012 00:04:03 -0500 (EST) 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 JqnSY5-jNWod; Tue, 6 Mar 2012 00:04:02 -0500 (EST) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 8E7369D253; Tue, 6 Mar 2012 00:03:57 -0500 (EST) 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 193C29D253 for ; Tue, 6 Mar 2012 00:03:56 -0500 (EST) 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 FWkXlBFIVhRg for ; Tue, 6 Mar 2012 00:03:51 -0500 (EST) Received: from mail-we0-f172.google.com (mail-we0-f172.google.com [74.125.82.172]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (not verified)) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id A6B819D235 for ; Tue, 6 Mar 2012 00:03:51 -0500 (EST) Received: by werb10 with SMTP id b10so4408098wer.17 for ; Mon, 05 Mar 2012 21:03:50 -0800 (PST) Received-SPF: pass (google.com: domain of jithujance@gmail.com designates 10.216.82.141 as permitted sender) client-ip=10.216.82.141; Authentication-Results: mr.google.com; spf=pass (google.com: domain of jithujance@gmail.com designates 10.216.82.141 as permitted sender) smtp.mail=jithujance@gmail.com; dkim=pass header.i=jithujance@gmail.com Received: from mr.google.com ([10.216.82.141]) by 10.216.82.141 with SMTP id o13mr7461631wee.2.1331010230446 (num_hops = 1); Mon, 05 Mar 2012 21:03:50 -0800 (PST) MIME-Version: 1.0 Received: by 10.216.82.141 with SMTP id o13mr5960503wee.2.1331010230371; Mon, 05 Mar 2012 21:03:50 -0800 (PST) Received: by 10.180.107.137 with HTTP; Mon, 5 Mar 2012 21:03:50 -0800 (PST) Date: Tue, 6 Mar 2012 10:33:50 +0530 Message-ID: Subject: Re: [RFC 1/4] P2P: Handling single channel concurrency From: Jithu Jance To: hostap@lists.shmoo.com 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: , Mime-version: 1.0 Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com Sorry for a delayed reply. Please find my comments inline. > No, this is different case. I was thinking of a case that does not have > any concurrency at all, i.e., just a single P2P client interface that is > associated with a GO that decides to change channels. Though, maybe I > missed the part of shared_freq>0 not hitting in this particular > sequence. You are right. The shared_freq won't be returning a greater than zero in this case. >> e) If the priority is not set, the default behavior is to notify the >> upper application or framework. The supplicant >> won't do any policing. > Hmm.. How is this different from (d) ? Both d and e are handled in the same way. But just i had put mentioned it separately to indicate that both are handled. I have took your set of patches and did the below additions and generated 4 patches. 1. Moved the prioritize setting to wpa_global 2. Applied the below two changes. +++++++++++++++++++++ > Two more changes from my side which are not in the current set of patches. > a) I later felt that providing network_id would be better than providing > ssid and bssid during WPA_EVENT_FREQ_CONFLICT. > +▷⋅⋅▷⋅⋅⋅▷⋅⋅⋅wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_FREQ_CONFLICT > +▷⋅⋅▷⋅⋅⋅▷⋅⋅⋅▷⋅⋅⋅" ssid=%s bssid=" MACSTR, > +▷⋅⋅▷⋅⋅⋅▷⋅⋅⋅▷⋅⋅⋅wpa_ssid_txt(ssid->ssid, ssid->ssid_len), > +▷⋅⋅▷⋅⋅⋅▷⋅⋅⋅▷⋅⋅⋅MAC2STR(wpa_s->pending_bssid)); > > changed to > > +▷⋅⋅▷⋅⋅⋅▷⋅⋅⋅wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_FREQ_CONFLICT > " id=%d", ssid->id);. > b) I have added a new reason code to P2P_GROUP_REMOVE > reason=FREQ_CONFLICT. This is useful when a p2p group gets removed when STA > connection has more priority. +++++++++++++++++++++ Till here ++++++++++++++ 3. Still some things are left behind. I will work on these once the attached patches are frozen. a) supplicant gets the STA connected event while we already have a p2p connection on some other channel (roaming handled by driver/firmware). b) The concurrent-3.patch expansion [go_switch_channel]. I am splitting the reply into 4 RFC patches. First one: [PATCH] Add an additional param 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 | 12 +++++++++++- wpa_supplicant/wpa_supplicant_i.h | 2 ++ 3 files changed, 27 insertions(+), 1 deletions(-) void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s); diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 11f4674..2e12845 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -3418,6 +3418,20 @@ static int p2p_ctrl_set(struct wpa_supplicant *wpa_s, char *cmd) return 0; } + 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; + } + wpa_printf(MSG_DEBUG, "Single Channel Concurrency: Prioritize %s", + wpa_s->global->conc_priority); + 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 fdee407..1004746 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -3152,9 +3152,19 @@ void wpas_connection_failed(struct wpa_supplicant *wpa_s, const u8 *bssid) 1000 * (timeout % 1000)); } - 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(os_strncmp(wpa_s->global->conc_priority, "p2p", 3) == 0) + return 1; + else if(os_strncmp(wpa_s->global->conc_priority, "sta", 3) == 0) + return 0; + + /* IF conc_priority is not set, return -1 */ + return -1; +} diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index 0ba1935..2ffefde 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -228,6 +228,7 @@ struct wpa_global { int cross_connection; struct wpa_freq_range *p2p_disallow_freq; unsigned int num_p2p_disallow_freq; + char conc_priority[5]; /* "sta" or "p2p" */ }; @@ -612,6 +613,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 */