From patchwork Mon Dec 16 20:08:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 301819 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 1F0BF2C007C for ; Tue, 17 Dec 2013 07:10:46 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id B4E9B9D4E0; Mon, 16 Dec 2013 15:10:24 -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 JxjnmsD2XQxf; Mon, 16 Dec 2013 15:10:24 -0500 (EST) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 15D269D49F; Mon, 16 Dec 2013 15:09:13 -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 005C417C043 for ; Mon, 16 Dec 2013 15:09:12 -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 3TvtjqyYAmxd for ; Mon, 16 Dec 2013 15:09:06 -0500 (EST) Received: from sipsolutions.net (s3.sipsolutions.net [144.76.43.152]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (Client did not present a certificate) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id 137C89D48E for ; Mon, 16 Dec 2013 15:08:53 -0500 (EST) Received: by sipsolutions.net with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA256:128) (Exim 4.80) (envelope-from ) id 1VseTD-0001Wv-Tq; Mon, 16 Dec 2013 21:08:52 +0100 From: Johannes Berg To: hostap@lists.shmoo.com Subject: [PATCH 06/23] wpa_supplicant: use monotonic time for SA query timeout Date: Mon, 16 Dec 2013 21:08:27 +0100 Message-Id: <1387224524-17441-7-git-send-email-johannes@sipsolutions.net> X-Mailer: git-send-email 1.8.5.1 In-Reply-To: <1387224524-17441-1-git-send-email-johannes@sipsolutions.net> References: <1387224524-17441-1-git-send-email-johannes@sipsolutions.net> Cc: Johannes Berg 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: Johannes Berg The SA query timeout is just a regular timeout (currently hard-coded to 1000 TU), so use monotonic time for it. Signed-off-by: Johannes Berg --- wpa_supplicant/sme.c | 8 ++++---- wpa_supplicant/wpa_supplicant_i.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c index 87c14ae..3a96623 100644 --- a/wpa_supplicant/sme.c +++ b/wpa_supplicant/sme.c @@ -1151,9 +1151,9 @@ static const unsigned int sa_query_retry_timeout = 201; static int sme_check_sa_query_timeout(struct wpa_supplicant *wpa_s) { u32 tu; - struct os_time now, passed; - os_get_time(&now); - os_time_sub(&now, &wpa_s->sme.sa_query_start, &passed); + struct os_reltime now, passed; + os_get_reltime(&now); + os_reltime_sub(&now, &wpa_s->sme.sa_query_start, &passed); tu = (passed.sec * 1000000 + passed.usec) / 1024; if (sa_query_max_timeout < tu) { wpa_dbg(wpa_s, MSG_DEBUG, "SME: SA Query timed out"); @@ -1203,7 +1203,7 @@ static void sme_sa_query_timer(void *eloop_ctx, void *timeout_ctx) return; if (wpa_s->sme.sa_query_count == 0) { /* Starting a new SA Query procedure */ - os_get_time(&wpa_s->sme.sa_query_start); + os_get_reltime(&wpa_s->sme.sa_query_start); } trans_id = nbuf + wpa_s->sme.sa_query_count * WLAN_SA_QUERY_TR_ID_LEN; wpa_s->sme.sa_query_trans_id = nbuf; diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index 8cc813c..d96d5e4 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -551,7 +551,7 @@ struct wpa_supplicant { u8 *sa_query_trans_id; /* buffer of WLAN_SA_QUERY_TR_ID_LEN * * sa_query_count octets of pending * SA Query transaction identifiers */ - struct os_time sa_query_start; + struct os_reltime sa_query_start; u8 sched_obss_scan; u16 obss_scan_int; u16 bss_max_idle_period;