From patchwork Thu Mar 6 18:06:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Qiu X-Patchwork-Id: 327652 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 108E92C00A6 for ; Fri, 7 Mar 2014 11:23:25 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 459D39C15D; Thu, 6 Mar 2014 19:23:17 -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 vDsYqG9XLHSf; Thu, 6 Mar 2014 19:23:17 -0500 (EST) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 93C099C136; Thu, 6 Mar 2014 19:23:12 -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 212BB9C136 for ; Thu, 6 Mar 2014 19:23:11 -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 2BdU8nAZBVVn for ; Thu, 6 Mar 2014 19:23:11 -0500 (EST) Received: from mail-ob0-f201.google.com (mail-ob0-f201.google.com [209.85.214.201]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (not verified)) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id E2AA49C135 for ; Thu, 6 Mar 2014 19:23:10 -0500 (EST) Received: by mail-ob0-f201.google.com with SMTP id gq1so738262obb.2 for ; Thu, 06 Mar 2014 16:23:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:date:subject:to:message-id; bh=DH58PqSMbqHPPyDZ2BtERFXs8geu10D7ldCzIlYOqvw=; b=K53DUyjH/P2KA+usLn74szaiWsdwEBoPc8ERLqZAISRrYk6givRlMIBPenPkrIeh/H qR57gz6xtlUhLmcbLVDxRNxk8/Jdlcs+7FE860ae4/6A1lUHsrUuntxZTCf3GKHyYPrc C8+B3/WAYgYoW49vBPG5jb1Q2PEhHk/FkC0jBJze9HWLAkz8kAsdaDoDKDuGYymFcBca n89lYAmTcPvf3lpKtddGuDVSgdEh38przn+wsZ1xWz3uhix7dy6416zNdhG5KF5DFx8c YLgoegPMj/0xq+YPiPqWT1Yb4xCSBchuymDlNOVJuBnbupyKZG2/rS8kjcC5oQBzs6hT I4jQ== X-Gm-Message-State: ALoCoQn+YW75FTYctOIrjztY/JIzS7/WCUvnW24FBciCIbBBagRQ/HF89tvY7OMclgYIsXDdcrKSFjEX0HRzemkajQBnG7b0ZlKJ/T4nAmjihSI5HiQXDuZJOl8Iga28RXI+h9GVcTagoi7twG6aBJwdrlaUb+iVsYkKqCmpTUAP8nN2D7EV7LwbcxTG+mEHxVvgX7d3FMlApolailJMpQIQaF10MM6sDuVP3FR9QY4oyxBX5b8CdSQ= X-Received: by 10.182.98.230 with SMTP id el6mr6627450obb.10.1394151789118; Thu, 06 Mar 2014 16:23:09 -0800 (PST) Received: from corp2gmr1-1.hot.corp.google.com (corp2gmr1-1.hot.corp.google.com [172.24.189.92]) by gmr-mx.google.com with ESMTPS id u63si1277398yhm.6.2014.03.06.16.23.09 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 06 Mar 2014 16:23:09 -0800 (PST) Received: from zqiu.mtv.corp.google.com (zqiu.mtv.corp.google.com [172.22.73.15]) by corp2gmr1-1.hot.corp.google.com (Postfix) with ESMTP id EF29A31C2F5 for ; Thu, 6 Mar 2014 16:23:08 -0800 (PST) Received: by zqiu.mtv.corp.google.com (Postfix, from userid 235984) id 89E5B1A1F62; Thu, 6 Mar 2014 16:23:08 -0800 (PST) From: Peter Qiu Date: Thu, 6 Mar 2014 10:06:04 -0800 Subject: [PATCH] Improve performance of reassociate operation To: hostap@lists.shmoo.com Message-Id: <20140307002308.89E5B1A1F62@zqiu.mtv.corp.google.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 Perform single-channel single-ssid scan instead of full scan for reassociate operation. This allows the scan result to come back in much faster time during reassociate. In ath9k, the scan took around 12 seconds without the fix, and only 0.1 second with the fix. Since for reassociate operation the only SSID we care about is the one we previously connected to, so it should be good idea to perform single-channel single-ssid scan for reassociate. Signed-hostap: Peter Qiu --- wpa_supplicant/scan.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c index f7eb537..9926e10 100644 --- a/wpa_supplicant/scan.c +++ b/wpa_supplicant/scan.c @@ -665,6 +665,30 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx) * wildcard SSID. */ ssid = NULL; + } else if (wpa_s->reassociate && wpa_s->current_ssid != NULL) { + /* + * Perform single-channel single-SSID scan for reassociate + * operation. + */ + /* Setup SSID */ + ssid = wpa_s->current_ssid; + wpa_hexdump_ascii(MSG_DEBUG, "Scan SSID", + ssid->ssid, ssid->ssid_len); + params.ssids[0].ssid = ssid->ssid; + params.ssids[0].ssid_len = ssid->ssid_len; + params.num_ssids = 1; + + /* + * Allocate memory for frequency array, allocate one extra + * slot for the zero-terminator. + */ + params.freqs = (int *)os_malloc(sizeof(int)*2); + if (params.freqs == NULL) { + wpa_dbg(wpa_s, MSG_ERROR, "Memory allocation failed"); + return; + } + params.freqs[0] = wpa_s->assoc_freq; + params.freqs[1] = 0; } else { struct wpa_ssid *start = ssid, *tssid; int freqs_set = 0;