From patchwork Fri Aug 10 11:17:03 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sujith Manoharan X-Patchwork-Id: 1305051 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 C6CC33FC66 for ; Fri, 10 Aug 2012 11:18:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751235Ab2HJLSS (ORCPT ); Fri, 10 Aug 2012 07:18:18 -0400 Received: from wolverine01.qualcomm.com ([199.106.114.254]:63277 "EHLO wolverine01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750781Ab2HJLSR (ORCPT ); Fri, 10 Aug 2012 07:18:17 -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=1344597498; x=1376133498; h=from:mime-version:content-transfer-encoding:message-id: date:to:cc:subject; bh=miH4+tbXaHiJkfIH1B4y20EtgqONlt/fjrPfW7AcV7w=; b=j/luMmF7Q11wXerVodwXpnnqpvalenTikqcxLynKICLNELs/H8/8wNr1 e6aCBt4t/VJHCo89fL9B1ZRvxVRC2qy90Vy9ZGrVsgOPQE+dU5mVi9rEQ DmNe4mVqUTu6ADWA/m8CgXwr2IYlMkHlXRAJwtUiMB+66u2NFFD8PXdOH A=; X-IronPort-AV: E=McAfee;i="5400,1158,6798"; a="223736563" Received: from ironmsg02-l.qualcomm.com ([172.30.48.16]) by wolverine01.qualcomm.com with ESMTP; 10 Aug 2012 04:18:18 -0700 X-IronPort-AV: E=Sophos;i="4.77,745,1336374000"; d="scan'208";a="122056771" Received: from nasanexhc04.na.qualcomm.com ([172.30.48.17]) by ironmsg02-L.qualcomm.com with ESMTP/TLS/RC4-SHA; 10 Aug 2012 04:18:18 -0700 Received: from alfalfa (172.30.48.1) by qcmail1.qualcomm.com (172.30.48.17) with Microsoft SMTP Server (TLS) id 14.2.309.2; Fri, 10 Aug 2012 04:18:16 -0700 From: Sujith Manoharan MIME-Version: 1.0 Message-ID: <20516.60847.547871.63036@gargle.gargle.HOWL> Date: Fri, 10 Aug 2012 16:47:03 +0530 To: X-Mailer: VM 8.2.0b under 24.1.1 (x86_64-unknown-linux-gnu) CC: Subject: [PATCH 11/15] 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;