Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2567492pxb; Sun, 3 Apr 2022 11:38:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJG6fJ7VI2LfS78Hp1L+8YSD9UagF+GoAVFkk5LINAXTFH5XckXcL6N7D5P1hHmdCcULNE X-Received: by 2002:a17:906:69d1:b0:6ce:7201:ec26 with SMTP id g17-20020a17090669d100b006ce7201ec26mr7795032ejs.105.1649011127742; Sun, 03 Apr 2022 11:38:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649011127; cv=none; d=google.com; s=arc-20160816; b=cw1RXDDyESizAZXUky6hW2SgP0GKcaiRqA1GwrHt58df4syO4EbR4Q5HNoPzAdJpou pzv44W+p2gMxoBymcqjMtLKDNyThQAjCpVWcTCRxANA33FcClEbDbDVmQtC6X5Rh4WoM hsW4372D1E1CsF/Q209TRECnQQxerhMko5tpJClSblJd3agKy3BrSl5CoNEoeO3OEacQ ttLp2X9i5HivCulrLL5o700+FHyn0YXybaCggnWqRvDxJW1L7UDZZXJ5REf90DU+Ihrw 0A14G8WtJdu2yWmj8NRNz83UyI97Ev/ulqqv4DAbJdxUlwNCTABgEF3U5DBLBB+PaM30 AufA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:dkim-signature:from; bh=DBJlmENNm579zFmeQWOraE+a2qj6rhoiZm4Id3F8AAU=; b=iVxcXKaQJZMQLExIamUMI0jZJ6vBTlE/6korKQejN8ogp37bDZe1VMGQuyKokJU8a4 smWbjPt4+Dffg/FC7MjNj2qe+4YZG4lJAI7cu7wmg1EjCPb/Vw3jpjad3d1CLcJPvXte UiitMMSiiRo4FFJc5uA5YuWoT4VYv1wl59kB+7w1WjHzaASW+SNAcnUEz1DpU4VljxFQ UkyHf4WDFVQDg7L580WYuKi9F0jJZC40jGV8EhYcZv1eHp4vA14VbNjvn79nOD5BB3NN Ruuy+5Znc4ByDq9ggNsfspud2z7g69G9XNXqwrTnGGZ3YnmBxd5IjgPRQuie7j/j0iJF 5Law== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@toke.dk header.s=20161023 header.b=TLfBjWhC; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=toke.dk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m20-20020a1709061ed400b006df83f92f6fsi5098752ejj.293.2022.04.03.11.38.22; Sun, 03 Apr 2022 11:38:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@toke.dk header.s=20161023 header.b=TLfBjWhC; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=toke.dk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235560AbiDBM3u (ORCPT + 68 others); Sat, 2 Apr 2022 08:29:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231490AbiDBM3s (ORCPT ); Sat, 2 Apr 2022 08:29:48 -0400 Received: from mail.toke.dk (mail.toke.dk [IPv6:2a0c:4d80:42:2001::664]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35C70D5EA4; Sat, 2 Apr 2022 05:27:57 -0700 (PDT) From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=toke.dk; s=20161023; t=1648902475; bh=O24983sUH73+7zh8F7+H1u+iS+44kE3Ad9wzWR8/DZU=; h=From:To:Cc:Subject:Date:From; b=TLfBjWhCeW9Lko2a7ewORthmCRjNnda1Yv2ADndIupf/1/T5MHTT+eXIoOGUi19ap H/JsW3XwXHp+7jsQvXtMxtxMq4tBywKLhIMO9dbjeHiyejIH55kMvnUHWlt5gATMPg aUjIDAstJfdGqI+ALZMooR4oxI6Ms8pLU/gcckNptqwoDC/DwjHN/7H26ATA1yvA1h njdgBlQh1kbgWmV0FFkI3y4tBbaE+y9KVpBXd8NZQupsIJz5DGPNI6R1nJpdKwWcRt ceYU3d7InewfiKPoY99LqyLtJ7JpzJ9DGPV/cnwJePkJHyJveEGiL97zxYxAIdnC41 vQ+GBEwESIY0g== To: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , Kalle Valo Cc: linux-wireless@vger.kernel.org, =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , stable@vger.kernel.org, Peter Seiderer Subject: [PATCH v5.18] ath9k: Save rate counts before clearing tx status area Date: Sat, 2 Apr 2022 14:27:51 +0200 Message-Id: <20220402122752.2347797-1-toke@toke.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Toke Høiland-Jørgensen The ieee80211_tx_info_clear_status() helper also clears the rate counts, so we should restore them after clearing. However, we can get rid of the existing clearing of the counts of invalid rates. Rearrange the code a bit so the order fits the indexes, and so the setting of the count to hw->max_rate_tries on underrun is not immediately overridden. Cc: stable@vger.kernel.org Reported-by: Peter Seiderer Fixes: 037250f0a45c ("ath9k: Properly clear TX status area before reporting to mac80211") Signed-off-by: Toke Høiland-Jørgensen --- drivers/net/wireless/ath/ath9k/xmit.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index cbcf96ac303e..ac7efecff29c 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c @@ -2551,16 +2551,19 @@ static void ath_tx_rc_status(struct ath_softc *sc, struct ath_buf *bf, struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); struct ieee80211_hw *hw = sc->hw; struct ath_hw *ah = sc->sc_ah; - u8 i, tx_rateindex; + u8 i, tx_rateindex, tries[IEEE80211_TX_MAX_RATES]; + + tx_rateindex = ts->ts_rateindex; + WARN_ON(tx_rateindex >= hw->max_rates); + + for (i = 0; i < tx_rateindex; i++) + tries[i] = tx_info->status.rates[i].count; ieee80211_tx_info_clear_status(tx_info); if (txok) tx_info->status.ack_signal = ts->ts_rssi; - tx_rateindex = ts->ts_rateindex; - WARN_ON(tx_rateindex >= hw->max_rates); - if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) { tx_info->flags |= IEEE80211_TX_STAT_AMPDU; @@ -2569,6 +2572,14 @@ static void ath_tx_rc_status(struct ath_softc *sc, struct ath_buf *bf, tx_info->status.ampdu_len = nframes; tx_info->status.ampdu_ack_len = nframes - nbad; + for (i = 0; i < tx_rateindex; i++) + tx_info->status.rates[i].count = tries[i]; + + tx_info->status.rates[tx_rateindex].count = ts->ts_longretry + 1; + + for (i = tx_rateindex + 1; i < hw->max_rates; i++) + tx_info->status.rates[i].idx = -1; + if ((ts->ts_status & ATH9K_TXERR_FILT) == 0 && (tx_info->flags & IEEE80211_TX_CTL_NO_ACK) == 0) { /* @@ -2591,12 +2602,6 @@ static void ath_tx_rc_status(struct ath_softc *sc, struct ath_buf *bf, hw->max_rate_tries; } - for (i = tx_rateindex + 1; i < hw->max_rates; i++) { - tx_info->status.rates[i].count = 0; - tx_info->status.rates[i].idx = -1; - } - - tx_info->status.rates[tx_rateindex].count = ts->ts_longretry + 1; } static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq) -- 2.35.1