From patchwork Fri Apr 9 09:14:57 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 49792 X-Patchwork-Delegate: stefan.bader@canonical.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 9BAEBB7D0A for ; Fri, 9 Apr 2010 19:15:11 +1000 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.69) (envelope-from ) id 1O0AIl-0000gK-KV; Fri, 09 Apr 2010 10:14:59 +0100 Received: from adelie.canonical.com ([91.189.90.139]) by chlorine.canonical.com with esmtp (Exim 4.69) (envelope-from ) id 1O0AIk-0000gF-Ql for kernel-team@lists.ubuntu.com; Fri, 09 Apr 2010 10:14:58 +0100 Received: from hutte.canonical.com ([91.189.90.181]) by adelie.canonical.com with esmtp (Exim 4.69 #1 (Debian)) id 1O0AIk-0000gZ-Nx for ; Fri, 09 Apr 2010 10:14:58 +0100 Received: from cpc7-craw6-2-0-cust128.croy.cable.virginmedia.com ([94.172.219.129] helo=localhost) by hutte.canonical.com with esmtpsa (TLS-1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.69) (envelope-from ) id 1O0AIk-0005HA-F2 for kernel-team@lists.ubuntu.com; Fri, 09 Apr 2010 10:14:58 +0100 From: Colin King To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/1] UBUNTU: rt2x00: re-adjust wifi signal strength range Date: Fri, 9 Apr 2010 10:14:57 +0100 Message-Id: <1270804497-16001-2-git-send-email-colin.king@canonical.com> X-Mailer: git-send-email 1.7.0 In-Reply-To: <1270804497-16001-1-git-send-email-colin.king@canonical.com> References: <1270804497-16001-1-git-send-email-colin.king@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com From: Colin Ian King BugLink: https://bugs.launchpad.net/bugs/557239 The range of signal strength reported by rt2x00 is very narrow and the base offset is too low. The original algorithm was based on a mix of 20% from the RSSI, 40% from RX quality and 40% from TX quality metrics. For the rt73usb driver, the TX failure metric is a piece of fiction and always returns success (unless there is a USB URB failure) so this skews the TX quality metrics and hence skews the signal strength result. The original calculation is only really useful for a network that you're already connected to. The reliance on RX and TX quality metrics when not connected to a network skews the final signal strength since the only valid metric (RSSI) is a minor contributor to the final calculation. A survey of most wifi drivers show that using just the RSSI is a common method of producing a signal strength metric, so this fix adjusts the wifi strength to be calculated just on RSSI. This fix also adjusts the range of the DEFAULT_RSSI_OFFSET to correctly reflect the absolute maximum range of the RSSI. The original code was a little overzealous in providing enough headroom. Signed-off-by: Colin Ian King Acked-by: Andy Whitcroft Acked-by: Stefan Bader --- .../drivers/net/wireless/rt2x00/rt2x00.h | 6 +++--- .../drivers/net/wireless/rt2x00/rt73usb.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2x00.h b/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2x00.h index 311b8d0..97812c8 100644 --- a/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2x00.h +++ b/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt2x00.h @@ -196,9 +196,9 @@ struct link_qual { int tx_percentage; int tx_success; int tx_failed; -#define WEIGHT_RSSI 20 -#define WEIGHT_RX 40 -#define WEIGHT_TX 40 +#define WEIGHT_RSSI 100 +#define WEIGHT_RX 0 +#define WEIGHT_TX 0 }; /* diff --git a/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt73usb.h b/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt73usb.h index 60f98be..97f9503 100644 --- a/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt73usb.h +++ b/updates/compat-wireless-2.6/drivers/net/wireless/rt2x00/rt73usb.h @@ -39,7 +39,7 @@ * Signal information. * Defaul offset is required for RSSI <-> dBm conversion. */ -#define DEFAULT_RSSI_OFFSET 120 +#define DEFAULT_RSSI_OFFSET 104 /* * Register layout information.