From patchwork Mon May 21 06:17:06 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jithu Jance X-Patchwork-Id: 160318 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 97ADAB6F9D for ; Mon, 21 May 2012 16:17:37 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 486BA9C1B9; Mon, 21 May 2012 02:17:33 -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 hcqoqymSzDYy; Mon, 21 May 2012 02:17:33 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 24AED9C1D9; Mon, 21 May 2012 02:17:29 -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 7317B9C1D9 for ; Mon, 21 May 2012 02:17:27 -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 SLGOQN2oiFGZ for ; Mon, 21 May 2012 02:17:22 -0400 (EDT) Received: from mms2.broadcom.com (mms2.broadcom.com [216.31.210.18]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 713BE9C1B9 for ; Mon, 21 May 2012 02:17:22 -0400 (EDT) Received: from [10.16.192.224] by mms2.broadcom.com with ESMTP (Broadcom SMTP Relay (Email Firewall v6.5)); Sun, 20 May 2012 23:17:47 -0700 X-Server-Uuid: 72204117-5C29-4314-8910-60DB108979CB Received: from SJEXCHCAS06.corp.ad.broadcom.com (10.16.203.15) by SJEXCHHUB01.corp.ad.broadcom.com (10.16.192.224) with Microsoft SMTP Server (TLS) id 8.2.247.2; Sun, 20 May 2012 23:17:08 -0700 Received: from SJEXCHMB09.corp.ad.broadcom.com ( [fe80::3da7:665e:cc78:181f]) by SJEXCHCAS06.corp.ad.broadcom.com ( [::1]) with mapi id 14.01.0355.002; Sun, 20 May 2012 23:17:07 -0700 From: "Jithu Jance" To: "hostap@lists.shmoo.com" Subject: [PATCH] Speed up connection time during ASSOC retry Thread-Topic: [PATCH] Speed up connection time during ASSOC retry Thread-Index: Ac03GUV2iwj1eii1SD+7YxKJZjiRjg== Date: Mon, 21 May 2012 06:17:06 +0000 Message-ID: <25A448014331D04F82E3035BCF9620AF06E626@SJEXCHMB09.corp.ad.broadcom.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.9.208.26] MIME-Version: 1.0 X-WSS-ID: 63A7018144G7575717-01-01 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 In current implementation, authentication timer continues to run even after the driver has reported ASSOC_REJECT. Then the association is retried on authentication timeout which is 10secs. The below patch cancels the authentication timeout on ASSOC_REJECT and initiates an scan for association. Kindly see whether the patch is fine. [PATCH] Speed up connection time during ASSOC retry Avoid waiting for authentication timeout, If driver reports ASSOC-REJECT Signed-off-by: Jithu Jance --- wpa_supplicant/events.c | 19 +++++++++++++++++++ wpa_supplicant/wpa_supplicant.c | 3 +++ wpa_supplicant/wpa_supplicant_i.h | 1 + 3 files changed, 23 insertions(+), 0 deletions(-) diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 407407a..25c8f90 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -2238,6 +2238,25 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event, data->assoc_reject.status_code); if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) sme_event_assoc_reject(wpa_s, data); + + /* If assoc reject is reported by the driver, then avoid + * waiting for the authentication timeout. Cancel the + * authentication timeout and retry the assoc. + */ + if(wpa_s->assoc_retries++ < 3) { + wpa_printf(MSG_ERROR, "Retrying assoc " + "Iteration:%d", wpa_s->assoc_retries); + wpa_supplicant_cancel_auth_timeout(wpa_s); + + /* Clear the states */ + wpa_sm_notify_disassoc(wpa_s->wpa); + wpa_supplicant_disassociate(wpa_s, WLAN_REASON_DEAUTH_LEAVING); + + wpa_s->reassociate = 1; + wpa_supplicant_req_scan(wpa_s, 1, 0); + } else { + wpa_s->assoc_retries = 0; + } break; case EVENT_AUTH_TIMED_OUT: if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_SME) diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 09b1640..12adb1b 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -585,6 +585,9 @@ void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s, wpa_supplicant_state_txt(wpa_s->wpa_state), wpa_supplicant_state_txt(state)); + if(state == WPA_ASSOCIATED || (state <= WPA_INACTIVE)) + wpa_s->assoc_retries = 0; + if (state != WPA_SCANNING) wpa_supplicant_notify_scanning(wpa_s, 0); diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index 23ffd7d..07837e2 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -286,6 +286,7 @@ struct wpa_supplicant { struct wpa_bss *current_bss; int ap_ies_from_associnfo; unsigned int assoc_freq; + unsigned int assoc_retries; /* Selected configuration (based on Beacon/ProbeResp WPA IE) */ int pairwise_cipher;