From patchwork Tue Aug 7 01:14:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sujith Manoharan X-Patchwork-Id: 1282331 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 904FE3FC23 for ; Tue, 7 Aug 2012 01:15:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757135Ab2HGBPy (ORCPT ); Mon, 6 Aug 2012 21:15:54 -0400 Received: from wolverine01.qualcomm.com ([199.106.114.254]:8008 "EHLO wolverine01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757131Ab2HGBPy (ORCPT ); Mon, 6 Aug 2012 21:15:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qca.qualcomm.com; i=@qca.qualcomm.com; q=dns/txt; s=qcdkim; t=1344302155; x=1375838155; h=from:mime-version:content-transfer-encoding:message-id: date:to:cc:subject; bh=miH4+tbXaHiJkfIH1B4y20EtgqONlt/fjrPfW7AcV7w=; b=QXc0re6BDZyBxM3qFgK59bvrhOQOkftXiKqkHVfh8ND4O4Y3SPnhcYFM r/lCl2Ca+RFQkz3whLOOG2LRk8DN+SajVH6QAkDQMXXkYnOxolnQFVyXL yREgsaEtnRpFPMLL9gBu5QQBQu8W80AwFFwEemsXlWhfQkjPe2KJWqkks k=; X-IronPort-AV: E=McAfee;i="5400,1158,6795"; a="221455663" Received: from ironmsg02-r.qualcomm.com ([172.30.46.16]) by wolverine01.qualcomm.com with ESMTP; 06 Aug 2012 18:15:55 -0700 X-IronPort-AV: E=Sophos;i="4.77,723,1336374000"; d="scan'208";a="160331234" Received: from nasanexhc08.na.qualcomm.com ([172.30.39.7]) by ironmsg02-R.qualcomm.com with ESMTP/TLS/RC4-SHA; 06 Aug 2012 18:15:55 -0700 Received: from nasanexhc05.na.qualcomm.com (172.30.48.2) by nasanexhc08.na.qualcomm.com (172.30.39.7) with Microsoft SMTP Server (TLS) id 14.2.309.2; Mon, 6 Aug 2012 18:15:54 -0700 Received: from sarge (172.30.48.1) by qcmail1.qualcomm.com (172.30.48.2) with Microsoft SMTP Server (TLS) id 14.2.309.2; Mon, 6 Aug 2012 18:15:53 -0700 From: Sujith Manoharan MIME-Version: 1.0 Message-ID: <20512.27641.143700.249316@gargle.gargle.HOWL> Date: Tue, 7 Aug 2012 06:44:33 +0530 To: X-Mailer: VM 8.2.0b under 24.1.1 (x86_64-unknown-linux-gnu) CC: Subject: [RFC 11/14] ath9k: Bail out properly before calculating rate index X-Originating-IP: [172.30.48.1] Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Signed-off-by: Sujith Manoharan --- drivers/net/wireless/ath/ath9k/rc.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c index a94c52b..0e3d20a 100644 --- a/drivers/net/wireless/ath/ath9k/rc.c +++ b/drivers/net/wireless/ath/ath9k/rc.c @@ -1264,23 +1264,12 @@ static void ath_tx_status(void *priv, struct ieee80211_supported_band *sband, struct ath_softc *sc = priv; struct ath_rate_priv *ath_rc_priv = priv_sta; struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); - struct ieee80211_hdr *hdr; + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; int final_ts_idx = 0, tx_status = 0; int long_retry = 0; - __le16 fc; + __le16 fc = hdr->frame_control; int i; - hdr = (struct ieee80211_hdr *)skb->data; - fc = hdr->frame_control; - for (i = 0; i < sc->hw->max_rates; i++) { - struct ieee80211_tx_rate *rate = &tx_info->status.rates[i]; - if (rate->idx < 0 || !rate->count) - break; - - final_ts_idx = i; - long_retry = rate->count - 1; - } - if (!priv_sta || !ieee80211_is_data(fc)) return; @@ -1292,6 +1281,15 @@ static void ath_tx_status(void *priv, struct ieee80211_supported_band *sband, if (tx_info->flags & IEEE80211_TX_STAT_TX_FILTERED) return; + for (i = 0; i < sc->hw->max_rates; i++) { + struct ieee80211_tx_rate *rate = &tx_info->status.rates[i]; + if (rate->idx < 0 || !rate->count) + break; + + final_ts_idx = i; + long_retry = rate->count - 1; + } + if (!(tx_info->flags & IEEE80211_TX_STAT_ACK)) tx_status = 1;