From patchwork Sat Dec 8 00:58:23 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eyal Shapira X-Patchwork-Id: 1852261 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 54F52400ED for ; Sat, 8 Dec 2012 00:58:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757356Ab2LHA6i (ORCPT ); Fri, 7 Dec 2012 19:58:38 -0500 Received: from mail-ee0-f46.google.com ([74.125.83.46]:52591 "EHLO mail-ee0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757335Ab2LHA6i (ORCPT ); Fri, 7 Dec 2012 19:58:38 -0500 Received: by mail-ee0-f46.google.com with SMTP id e53so603931eek.19 for ; Fri, 07 Dec 2012 16:58:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=cEjX9qjmp33RjXS/GALFyAAtSO25fevEHkGnD486Vfc=; b=IUBIqpue/R+bIEhfYNTezQ4uEgATJezWRA/ILs5Lz2jHw7xMigo2uXlD0RILOQqleq MxVcX6+13oQQc7FRP7BnQVbwvAAZNXFoAnyFqkdZhcRxQ/Y2vHjyvWYPITBDF/9u2SAM ndAzEKIZlkm27PKtnzkCiPUs+eG2MsZddEbxcKZ6+BimRXylwDuEOQl2q3QLs5ZrpNF8 8cBezd/gsQW4WITA846Jcy5pvt4CL0+BZP38K/Npuos7bL3s7tcCtS/ygUpiBKHwdcBg m9mAWNkPZQClMh41MfOTTDft8wIlMiP3W9lrxDiHkGYI8eDxmi4MeYmuCj6WE8QoMpul wzLw== Received: by 10.14.223.200 with SMTP id v48mr22833135eep.24.1354928316473; Fri, 07 Dec 2012 16:58:36 -0800 (PST) Received: from localhost.localdomain ([213.57.42.169]) by mx.google.com with ESMTPS id e2sm26110464eeo.8.2012.12.07.16.58.34 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 07 Dec 2012 16:58:35 -0800 (PST) From: Eyal Shapira To: Luciano Coelho Cc: , Arik Nemtsov Subject: [PATCH v3] wlcore: increase scan dwell times if no activity Date: Sat, 8 Dec 2012 02:58:23 +0200 Message-Id: <1354928303-13438-1-git-send-email-eyal@wizery.com> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQlFO2aBRj0tgYES07djIyqrGL8nXCwgIupI1JXXvU0lEq7zHDFjzbWjn6ImmPtrK5udFy/Q Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org There's a limit on scan dwell times of max 30ms in order to avoid degrading voip traffic which could be going on while scanning. However these dwell times increase the chance of missing out on nearby APs leading to partial scan results. Allow configuration of longer dwell times in case there no active interface (i.e. no STA associated or AP up). [Arik - count started vifs using an in-driver function] Signed-off-by: Eyal Shapira Signed-off-by: Arik Nemtsov --- v3: change semantics of new conf values to long dwell time (Thanks Luca) This applies on top of Luca's current master (WLCORE_CONF_VERSION changes to 5 instead of 6 in v2) drivers/net/wireless/ti/wl12xx/main.c | 2 ++ drivers/net/wireless/ti/wl18xx/main.c | 2 ++ drivers/net/wireless/ti/wlcore/conf.h | 26 +++++++++++++++++++++++++- drivers/net/wireless/ti/wlcore/scan.c | 30 +++++++++++++++++++++++++++--- 4 files changed, 56 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/ti/wl12xx/main.c b/drivers/net/wireless/ti/wl12xx/main.c index 64a5e81..e703ae7 100644 --- a/drivers/net/wireless/ti/wl12xx/main.c +++ b/drivers/net/wireless/ti/wl12xx/main.c @@ -267,6 +267,8 @@ static struct wlcore_conf wl12xx_conf = { .scan = { .min_dwell_time_active = 7500, .max_dwell_time_active = 30000, + .min_dwell_time_active_long = 25000, + .max_dwell_time_active_long = 50000, .dwell_time_passive = 100000, .dwell_time_dfs = 150000, .num_probe_reqs = 2, diff --git a/drivers/net/wireless/ti/wl18xx/main.c b/drivers/net/wireless/ti/wl18xx/main.c index e6f64a4..e23dff8 100644 --- a/drivers/net/wireless/ti/wl18xx/main.c +++ b/drivers/net/wireless/ti/wl18xx/main.c @@ -394,6 +394,8 @@ static struct wlcore_conf wl18xx_conf = { .scan = { .min_dwell_time_active = 7500, .max_dwell_time_active = 30000, + .min_dwell_time_active_long = 25000, + .max_dwell_time_active_long = 50000, .dwell_time_passive = 100000, .dwell_time_dfs = 150000, .num_probe_reqs = 2, diff --git a/drivers/net/wireless/ti/wlcore/conf.h b/drivers/net/wireless/ti/wlcore/conf.h index b64d6b5..b3c2dac 100644 --- a/drivers/net/wireless/ti/wlcore/conf.h +++ b/drivers/net/wireless/ti/wlcore/conf.h @@ -1044,6 +1044,7 @@ struct conf_roam_trigger_settings { struct conf_scan_settings { /* * The minimum time to wait on each channel for active scans + * This value will be used whenever there's a connected interface. * * Range: u32 tu/1000 */ @@ -1051,11 +1052,34 @@ struct conf_scan_settings { /* * The maximum time to wait on each channel for active scans + * This value will be currently used whenever there's a + * connected interface. It shouldn't exceed 30000 (~30ms) to avoid + * possible interference of voip traffic going on while scanning. * * Range: u32 tu/1000 */ u32 max_dwell_time_active; + /* + * The minimum time to wait on each channel for active scans + * when it's possible to have longer scan dwell times. + * Currently this is used whenever we're idle on all interfaces. + * Longer dwell times improve detection of networks within a + * single scan. + * + * Range: u32 tu/1000 + */ + u32 min_dwell_time_active_long; + + /* + * The maximum time to wait on each channel for active scans + * when it's possible to have longer scan dwell times. + * See min_dwell_time_active_long + * + * Range: u32 tu/1000 + */ + u32 max_dwell_time_active_long; + /* time to wait on the channel for passive scans (in TU/1000) */ u32 dwell_time_passive; @@ -1278,7 +1302,7 @@ struct conf_recovery_settings { * version, the two LSB are the lower driver's private conf * version. */ -#define WLCORE_CONF_VERSION (0x0004 << 16) +#define WLCORE_CONF_VERSION (0x0005 << 16) #define WLCORE_CONF_MASK 0xffff0000 #define WLCORE_CONF_SIZE (sizeof(struct wlcore_conf_header) + \ sizeof(struct wlcore_conf)) diff --git a/drivers/net/wireless/ti/wlcore/scan.c b/drivers/net/wireless/ti/wlcore/scan.c index 7f42f8a..6cfdeae 100644 --- a/drivers/net/wireless/ti/wlcore/scan.c +++ b/drivers/net/wireless/ti/wlcore/scan.c @@ -89,6 +89,25 @@ out: } +static void wlcore_started_vifs_iter(void *data, u8 *mac, + struct ieee80211_vif *vif) +{ + int *count = (int *)data; + + if (!vif->bss_conf.idle) + (*count)++; +} + +static int wlcore_count_started_vifs(struct wl1271 *wl) +{ + int count = 0; + + ieee80211_iterate_active_interfaces_atomic(wl->hw, + IEEE80211_IFACE_ITER_RESUME_ALL, + wlcore_started_vifs_iter, &count); + return count; +} + static int wlcore_scan_get_channels(struct wl1271 *wl, struct ieee80211_channel *req_channels[], @@ -109,9 +128,14 @@ wlcore_scan_get_channels(struct wl1271 *wl, /* configure dwell times according to scan type */ if (scan_type == SCAN_TYPE_SEARCH) { struct conf_scan_settings *c = &wl->conf.scan; - - min_dwell_time_active = c->min_dwell_time_active; - max_dwell_time_active = c->max_dwell_time_active; + bool active_vif_exists = !!wlcore_count_started_vifs(wl); + + min_dwell_time_active = active_vif_exists ? + c->min_dwell_time_active : + c->min_dwell_time_active_long; + max_dwell_time_active = active_vif_exists ? + c->max_dwell_time_active : + c->max_dwell_time_active_long; dwell_time_passive = c->dwell_time_passive; dwell_time_dfs = c->dwell_time_dfs; } else {