Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9928421ybi; Wed, 24 Jul 2019 12:29:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqw3n2/Gfx7GeVYxxvlTYyR+4Kre8IqGdYOcobi0D9z4hZvg3CF+eVLcwUCRR5djPGWJg1xe X-Received: by 2002:a17:902:a714:: with SMTP id w20mr87504759plq.127.1563996597086; Wed, 24 Jul 2019 12:29:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563996597; cv=none; d=google.com; s=arc-20160816; b=dzlnuKKJwzGd/COb5vBOkOgZKCdGn4G10b/96fyihD4uDRWbdNzCbfshwtU7sCYDOv 2OOt3UKPdfeUDIaOSE8T+MzQW4prrD3IS85wFk+PDmnXaWdyMb/F/+v33PVP+UdzNrVK qBUcCUAGi/wIkXOxk5CZWXax34lZppeaeyPBvsk79KF1JJayKHI4adE1pq7G9tDmlD2M kOYweSx/Gve3tgQvi/o7sgcxYCsFcxQMdnHDzc64/jURKfp8z6x+2M+D2tJ8X4VU92LQ K6Oru6s42lcYOnJXpyp+W4UozkB/W7uAtAsGzVqZKgaYjfbXACliC2jdp+XBskoOwiAO P77A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vDSbu6Q4owQqi5wua6JE3AVrPpVF4gNDviYnuYBZh+U=; b=G8L6f84VdCdqhA0IG1N30tRVDUc18SKt0OekgK95gu6HsSlTKesjFc7VGTHlma/7G+ qXG3ocw+Xu4daCa5v5glkn+Lg0XBra81GdhSfmQnX6Mlem3QgRcMTC37h8Y4r1IhnZ7n 8vSHTOz0cWyRSOhURuNDvpD5pduFHg7SMFbrQYTo48v4YTmFhsxMqzMGDzm8HeTGv4lY GD3UaVTCcdxkRfHqCQCz1wDKsjFjg2+G/vfJLmrUngS8sP+m5GHscQWUWos3u37Kpdl3 /0raF+YU4nQI+GWmzLhK+hdnpmlamEVFJJF5Ny1VkwIMl5BifY4RDRsBztQ01CRakwvw Lf/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FOUfXS60; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z15si18655425pgf.85.2019.07.24.12.29.42; Wed, 24 Jul 2019 12:29:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FOUfXS60; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387930AbfGXTYN (ORCPT + 99 others); Wed, 24 Jul 2019 15:24:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:40260 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387916AbfGXTYL (ORCPT ); Wed, 24 Jul 2019 15:24:11 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DAB4622387; Wed, 24 Jul 2019 19:24:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563996250; bh=z2tDvDZ1wSCfjB31V79vAvatC0HzUue8IWw2Z5RYXzA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FOUfXS60WsPhZmEg2VEZE/n6Hh+6xP77yQbIC+sa2ggDTX732RwqvdpbecQY7Q2wu ink5jqgrE1dLg4M5NAZkzeUZ+V46RTG2Du6SVPoun/9JyHKiFbajkSVo3Oo0Cg9MSq l0X4/OBbuhotvYmEcl6gbabsCq6WFppOXAxeUITA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miguel Catalan Cid , =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , Kalle Valo , Sasha Levin Subject: [PATCH 5.2 004/413] ath9k: Dont trust TX status TID number when reporting airtime Date: Wed, 24 Jul 2019 21:14:55 +0200 Message-Id: <20190724191735.486183261@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191735.096702571@linuxfoundation.org> References: <20190724191735.096702571@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 389b72e58259336c2d56d58b660b79cf4b9e0dcb ] As already noted a comment in ath_tx_complete_aggr(), the hardware will occasionally send a TX status with the wrong tid number. If we trust the value, airtime usage will be reported to the wrong AC, which can cause the deficit on that AC to become very low, blocking subsequent attempts to transmit. To fix this, account airtime usage to the TID number from the original skb, instead of the one in the hardware TX status report. Reported-by: Miguel Catalan Cid Signed-off-by: Toke Høiland-Jørgensen Signed-off-by: Kalle Valo Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath9k/xmit.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index b17e1ca40995..3be0aeedb9b5 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c @@ -668,7 +668,8 @@ static bool bf_is_ampdu_not_probing(struct ath_buf *bf) static void ath_tx_count_airtime(struct ath_softc *sc, struct ieee80211_sta *sta, struct ath_buf *bf, - struct ath_tx_status *ts) + struct ath_tx_status *ts, + u8 tid) { u32 airtime = 0; int i; @@ -679,7 +680,7 @@ static void ath_tx_count_airtime(struct ath_softc *sc, airtime += rate_dur * bf->rates[i].count; } - ieee80211_sta_register_airtime(sta, ts->tid, airtime, 0); + ieee80211_sta_register_airtime(sta, tid, airtime, 0); } static void ath_tx_process_buffer(struct ath_softc *sc, struct ath_txq *txq, @@ -709,7 +710,7 @@ static void ath_tx_process_buffer(struct ath_softc *sc, struct ath_txq *txq, if (sta) { struct ath_node *an = (struct ath_node *)sta->drv_priv; tid = ath_get_skb_tid(sc, an, bf->bf_mpdu); - ath_tx_count_airtime(sc, sta, bf, ts); + ath_tx_count_airtime(sc, sta, bf, ts, tid->tidno); if (ts->ts_status & (ATH9K_TXERR_FILT | ATH9K_TXERR_XRETRY)) tid->clear_ps_filter = true; } -- 2.20.1