Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3484173pxb; Mon, 4 Apr 2022 18:27:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTTQC9z9dDt2z6S+JZZHWl73uT9jv41u2GulJWBrdtBOEk/H3NQ6opvQXhuzMTsKAkmz8F X-Received: by 2002:a05:6a00:b53:b0:4fa:ecb7:1deb with SMTP id p19-20020a056a000b5300b004faecb71debmr1009008pfo.80.1649122029125; Mon, 04 Apr 2022 18:27:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649122029; cv=none; d=google.com; s=arc-20160816; b=CSBgG52L5mlfpgm0RQyVI1oOqZBzd8IasBT828wPvLNOIcKe29bybrSeLtD06zM7K2 sId+4+zHezHhSuHhCG96+4lexMDu9ORrYeVTpqmUeSXlGZ+7SlGpq2luxvl9hk9vwAGa yZOMS2xLE6Fsv1sXT+eq9xYp13hrpRHRfvpYrCe/qzomRI4h6o5K/sTnLn4XT0X2+j+o oNRj4dfSvhnN1RcfJMyC8jsDwzfhual0r9OFEEhk+o5fuwHDVm7xeGZSdS5wRg5/xeTh 9XTTcfgJWOins+DP99hbVBeUivG6AEellJ7QDo6tJL8vswvyUkvjG0OyAy62dmo80Hll Ebvg== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=ZvY4wZ9rBzi15EtYFnRPy1HdKnWrsRZjY6/5ze4sKiQ=; b=koTeEiAADTqpjzln75KcSW4YCqbC9T1hiJsN78+0iv8V0AjcMi1I6fvZYYcdloUTrc YXlwxlpQVHfuxODMnP2O+/gpSR6wrCcpjZsD1xMe/k5eSahg4Z4jRZXbRPqR9gzcwok1 pGVOZW62yWQ2cshtOEZqNqY3Wgl0iSBLXjX0bIayVkquP3Rubh4ZU3nNB+xOhGTY//PO hrHuQzxn85Pj/IpWOD24o4ClhqCFcq7tOnRH+HuD8w41SZJv2xcu+mv+CYbIppVwFaX8 fJnK90lrfvi6+xAMP81mpZgfdqOGJ0r06FrRFHKoaZSJd+1Dx4XmqCnfHkMpyn7GyXj1 l+BQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=GinRMsdp; spf=softfail (google.com: domain of transitioning linux-wireless-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmx.net Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id t4-20020a056a0021c400b004fa3a8dffd2si11970783pfj.137.2022.04.04.18.27.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 18:27:09 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-wireless-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=GinRMsdp; spf=softfail (google.com: domain of transitioning linux-wireless-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmx.net Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A03371697A4; Mon, 4 Apr 2022 17:16:43 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238522AbiDDVSU (ORCPT + 69 others); Mon, 4 Apr 2022 17:18:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378973AbiDDQNY (ORCPT ); Mon, 4 Apr 2022 12:13:24 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A68B2F009; Mon, 4 Apr 2022 09:11:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1649088679; bh=8zy/6p/pV0tkzHz053vouiUoj4m9fdn0vkgNGVSD/4M=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:In-Reply-To:References; b=GinRMsdp7HtQEmCuLTfwnVkTB72HeqN06PVFe2imZd4VMCSbRF97bl5XP0aS0WUie ytbqmyHVucelzvKPfViR5mAqbqUA4GNJPhxqj8yAUlmfGoAU8cCG7TnqsdqheGB9XT VIuUHSwfJD1js6ulQxyV4fdIL/mTgpQ+/h4F0coE= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost ([62.216.209.4]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MRCOK-1nPMd12DHI-00NC4k; Mon, 04 Apr 2022 18:11:19 +0200 Date: Mon, 4 Apr 2022 18:11:18 +0200 From: Peter Seiderer To: Toke =?UTF-8?B?SMO4aWxhbmQtSsO4cmdlbnNlbg==?= Cc: Kalle Valo , linux-wireless@vger.kernel.org, Toke =?UTF-8?B?SMO4aWxhbmQtSsO4cmdlbnNlbg==?= , stable@vger.kernel.org Subject: Re: [PATCH v5.18] ath9k: Save rate counts before clearing tx status area Message-ID: <20220404181118.515b60ad@gmx.net> In-Reply-To: <20220402122752.2347797-1-toke@toke.dk> References: <20220402122752.2347797-1-toke@toke.dk> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.33; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:MJaNJJ/tTgbL3TaXRwW4cRPQ58/zas+KLuWq4SdYCK/8v78boRa N0kBx403ExV/S38iljycj8wxw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u eXEo6cnNoRbePKpRiMlYng49w8IikVnmlak1NbHGxWBX339DyIu3QQGtgLaAhOfLwobULI4at 3H4mM0fKqi0CKkZnWqcKeeX78ar6mtTFlcRsyYSZ4YON+ZQQ2+Ivs+Je3pIaVevPFeTkPFxhJ F51GIhZFLlJW9d+hU4zKtfuPNORga9x9nOjPhATx5ic88MEQjeKl+KVTrjSMeK5crpxKJgVEG 4k4eZOKKndKOXY= X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Hello Toke, On Sat, 2 Apr 2022 14:27:51 +0200, Toke H=C3=B8iland-J=C3=B8rgensen wrote: > From: Toke H=C3=B8iland-J=C3=B8rgensen >=20 > 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. >=20 > Cc: stable@vger.kernel.org > Reported-by: Peter Seiderer > Fixes: 037250f0a45c ("ath9k: Properly clear TX status area before reporti= ng to mac80211") > Signed-off-by: Toke H=C3=B8iland-J=C3=B8rgensen > --- > drivers/net/wireless/ath/ath9k/xmit.c | 25 +++++++++++++++---------- > 1 file changed, 15 insertions(+), 10 deletions(-) >=20 > 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 =3D IEEE80211_SKB_CB(skb); > struct ieee80211_hw *hw =3D sc->hw; > struct ath_hw *ah =3D sc->sc_ah; > - u8 i, tx_rateindex; > + u8 i, tx_rateindex, tries[IEEE80211_TX_MAX_RATES]; > + > + tx_rateindex =3D ts->ts_rateindex; > + WARN_ON(tx_rateindex >=3D hw->max_rates); > + > + for (i =3D 0; i < tx_rateindex; i++) > + tries[i] =3D tx_info->status.rates[i].count; > =20 > ieee80211_tx_info_clear_status(tx_info); > =20 > if (txok) > tx_info->status.ack_signal =3D ts->ts_rssi; > =20 > - tx_rateindex =3D ts->ts_rateindex; > - WARN_ON(tx_rateindex >=3D hw->max_rates); > - > if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) { > tx_info->flags |=3D IEEE80211_TX_STAT_AMPDU; > =20 > @@ -2569,6 +2572,14 @@ static void ath_tx_rc_status(struct ath_softc *sc,= struct ath_buf *bf, > tx_info->status.ampdu_len =3D nframes; > tx_info->status.ampdu_ack_len =3D nframes - nbad; > =20 > + for (i =3D 0; i < tx_rateindex; i++) > + tx_info->status.rates[i].count =3D tries[i]; > + > + tx_info->status.rates[tx_rateindex].count =3D ts->ts_longretry + 1; > + > + for (i =3D tx_rateindex + 1; i < hw->max_rates; i++) > + tx_info->status.rates[i].idx =3D -1; > + > if ((ts->ts_status & ATH9K_TXERR_FILT) =3D=3D 0 && > (tx_info->flags & IEEE80211_TX_CTL_NO_ACK) =3D=3D 0) { > /* > @@ -2591,12 +2602,6 @@ static void ath_tx_rc_status(struct ath_softc *sc,= struct ath_buf *bf, > hw->max_rate_tries; > } The full lines above read: 2597 if (unlikely(ts->ts_flags & (ATH9K_TX_DATA_UNDERRUN | 2598 ATH9K_TX_DELIM_UNDERRUN))= && 2599 ieee80211_is_data(hdr->frame_control) &&=20 2600 ah->tx_trig_level >=3D sc->sc_ah->config.max_txtri= g_level ) 2601 tx_info->status.rates[tx_rateindex].count =3D 2602 hw->max_rate_tries; 2603 } So this patch fixes by drive-by a overwrite of tx_info->status.rates[tx_rat= eindex].count... > =20 > - for (i =3D tx_rateindex + 1; i < hw->max_rates; i++) { > - tx_info->status.rates[i].count =3D 0; > - tx_info->status.rates[i].idx =3D -1; > - } > - > - tx_info->status.rates[tx_rateindex].count =3D ts->ts_longretry + 1; > } > =20 > static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq) Otherwise looks good ;-), would like to give a Reviewed-by/Tested-by but st= ill affected by the underlying ieee80211_tx_info status vs. rate_driver_data ov= erwrite as mentioned in the other thread (see [1])... Regards, Peter [1] https://lore.kernel.org/linux-wireless/20220404130453.5ec6e045@gmx.net/