From patchwork Sat Aug 29 17:10:14 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivo van Doorn X-Patchwork-Id: 44700 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n7THAMTX017132 for ; Sat, 29 Aug 2009 17:10:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752090AbZH2RKR (ORCPT ); Sat, 29 Aug 2009 13:10:17 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752032AbZH2RKR (ORCPT ); Sat, 29 Aug 2009 13:10:17 -0400 Received: from mail-ew0-f206.google.com ([209.85.219.206]:42721 "EHLO mail-ew0-f206.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752029AbZH2RKQ (ORCPT ); Sat, 29 Aug 2009 13:10:16 -0400 Received: by ewy2 with SMTP id 2so2932665ewy.17 for ; Sat, 29 Aug 2009 10:10:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:subject:date :user-agent:cc:mime-version:content-type:content-transfer-encoding :content-disposition:message-id; bh=gImp2XKxK7MCjBw+Lm6s60yQrWg2AkP/gC9w6vpPKLE=; b=T6zmz0/VT+wVVmEu7ctGskJ5Xs6ecg9GfsTM81/Pd9MlxooMUFUCGTW2ceoKRWPPHx ZGAxHoXGeCQ38V9+ku3dxMFY/yQUz07GOVpfW310U88jTAzrzVKo1hq79l/H0TAeVw9C bkhCeOX/SV4cqp0+jdHNF2SU14jAqOWYJP2Pg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:user-agent:cc:mime-version:content-type :content-transfer-encoding:content-disposition:message-id; b=XuinpchjzQgshp4ZYwLRuguCzH4kTo+n2AeI2kiFVSwqHX162kx9Cs1tfNMJwxTC8U dE579IpxxdKFG/9ZDwMK9655BNEyGHnhplZxsXgCi36QZFdexUdJOxlzM6DTXbfXzweF cZu1s293CgmPg15Eh+pbmuxtZVwu1jtV8i4IU= Received: by 10.211.161.18 with SMTP id n18mr2939563ebo.26.1251565817124; Sat, 29 Aug 2009 10:10:17 -0700 (PDT) Received: from ?192.168.8.42? (k19232.upc-k.chello.nl [62.108.19.232]) by mx.google.com with ESMTPS id 7sm519258eyg.10.2009.08.29.10.10.15 (version=SSLv3 cipher=RC4-MD5); Sat, 29 Aug 2009 10:10:15 -0700 (PDT) From: Ivo van Doorn To: John Linville Subject: [PATCH] rt2x00: Fix TX status reporting Date: Sat, 29 Aug 2009 19:10:14 +0200 User-Agent: KMail/1.9.10 Cc: users@host1.serialmonkey.com, "linux-wireless" MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200908291910.14528.IvDoorn@gmail.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Not all values of the TX status enumeration were covered during updating of the TX statistics. This could lead to wrong bitrate tuning but also wrong behavior in tools like hostapd. Signed-off-by: Ivo van Doorn --- drivers/net/wireless/rt2x00/rt2x00dev.c | 28 ++++++++++++++++------------ 1 files changed, 16 insertions(+), 12 deletions(-) diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index 5db613f..71761b3 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c @@ -206,6 +206,7 @@ void rt2x00lib_txdone(struct queue_entry *entry, unsigned int header_length = ieee80211_get_hdrlen_from_skb(entry->skb); u8 rate_idx, rate_flags, retry_rates; unsigned int i; + bool success; /* * Unmap the skb. @@ -234,13 +235,18 @@ void rt2x00lib_txdone(struct queue_entry *entry, rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_TXDONE, entry->skb); /* - * Update TX statistics. + * Determine if the frame has been successfully transmitted. */ - rt2x00dev->link.qual.tx_success += + success = test_bit(TXDONE_SUCCESS, &txdesc->flags) || - test_bit(TXDONE_UNKNOWN, &txdesc->flags); - rt2x00dev->link.qual.tx_failed += - test_bit(TXDONE_FAILURE, &txdesc->flags); + test_bit(TXDONE_UNKNOWN, &txdesc->flags) || + test_bit(TXDONE_FALLBACK, &txdesc->flags); + + /* + * Update TX statistics. + */ + rt2x00dev->link.qual.tx_success += success; + rt2x00dev->link.qual.tx_failed += !success; rate_idx = skbdesc->tx_rate_idx; rate_flags = skbdesc->tx_rate_flags; @@ -263,22 +269,20 @@ void rt2x00lib_txdone(struct queue_entry *entry, tx_info->status.rates[i].flags = rate_flags; tx_info->status.rates[i].count = 1; } - if (i < (IEEE80211_TX_MAX_RATES -1)) + if (i < (IEEE80211_TX_MAX_RATES - 1)) tx_info->status.rates[i].idx = -1; /* terminate */ if (!(tx_info->flags & IEEE80211_TX_CTL_NO_ACK)) { - if (test_bit(TXDONE_SUCCESS, &txdesc->flags) || - test_bit(TXDONE_UNKNOWN, &txdesc->flags)) + if (success) tx_info->flags |= IEEE80211_TX_STAT_ACK; - else if (test_bit(TXDONE_FAILURE, &txdesc->flags)) + else rt2x00dev->low_level_stats.dot11ACKFailureCount++; } if (rate_flags & IEEE80211_TX_RC_USE_RTS_CTS) { - if (test_bit(TXDONE_SUCCESS, &txdesc->flags) || - test_bit(TXDONE_UNKNOWN, &txdesc->flags)) + if (success) rt2x00dev->low_level_stats.dot11RTSSuccessCount++; - else if (test_bit(TXDONE_FAILURE, &txdesc->flags)) + else rt2x00dev->low_level_stats.dot11RTSFailureCount++; }