From nobody Mon Sep 28 08:04:53 2026 Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4DB3943553A for ; Mon, 24 Aug 2026 14:24:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787581472; cv=none; b=JdNgXdNZEUNZW6tCmGXzbk4gJX5dkKMi48GV1FHbL19ytFNte86MKFzrfXAJBUCcVWui8PJdOX4tnh1CWM+bVT7nlspAJc7NGgbtULfxTequfa7uByXk5an/erZYxvqXX1y3AH6D/77RGIXdEahV87mN72WKnBvs8uXAUwDZ8oU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787581472; c=relaxed/simple; bh=im34TzSBvMs+VxSkzP69y69BJEr6lyQIVj6pgsKkYAc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=V0d8Wdk9uq3YhZY/8b3/zDfpTCt2LNe6L333+GBF0Z3vj3LYRHIR/MhJOo1Emc9sfTLdyjitRg3zbWJRu5ZdA233RLnjjPQ/9s0CKVZ6+k7603H02Le2jMkFGKP3VHhgGy1l4mi4QPsYoLC4a9zBreVdUghMnmunlCyynOaqpL0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bairaktaris.de; spf=pass smtp.mailfrom=bairaktaris.de; dkim=pass (2048-bit key) header.d=bairaktaris.de header.i=@bairaktaris.de header.b=f2410GRe; arc=none smtp.client-ip=209.85.218.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bairaktaris.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bairaktaris.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bairaktaris.de header.i=@bairaktaris.de header.b="f2410GRe" Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-c15f020a223so520985366b.1 for ; Mon, 24 Aug 2026 07:24:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bairaktaris.de; s=google; t=1787581469; x=1788186269; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=1VZl1PgTMrv9AbBgLJ1P6kkw01P+MG1RQDwfvaSet2M=; b=f2410GRed2o3ipO0+ImxgAlJVcw9dytub7Ue60fqUBomXRr2Yoay3iEOIGb7lmH3fy lJSU0G6SRPKA/5zZ2j6J5rETAoLQYKvSaUWjxYJ7ULuxfjnhhYuY2ux4XQUwMLoMUKJy Bf8m6+r54lYknVe7xflEyGR9tqE43NcCEZxoOymeaDpl08SnvG/Z+LQ4AYu3wkxdD3em d7u85LaazmSvoIHWIbIWxQAa87XZBD9RZEbOg9rYdTixzTsmNLYvrBNU6Oct/V+9M6nZ vGkNi+PvkaNscy5gOpJrHpXch8povCDQqBQEZMadOrcSgY676rsNBu7hB0IHf06Q4aJ5 H+6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787581469; x=1788186269; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=1VZl1PgTMrv9AbBgLJ1P6kkw01P+MG1RQDwfvaSet2M=; b=ffp3w8w2Dh5F6lXwyhUyncpKtw2ksEiY1/n+HuwFqhADwqquqUaXImcdqnXALiYsk8 IJ2LvpsYRuPD2K9DrAyE+Uu38/TgF6JUCPyGtBcs/LLc0dTgbpdJI/NHhhfYPCHqVWyd tsBRHC2PNkeqQj4Eek2P4bBmvmt7RItM7U63FZYzeGyAkE9+g13TgYzQwSXN58xhJCu5 QWEGmVDsbLxbEGxhNBc9Zv2dAzTM//CFNKZ+CeulUM03kBh0gnopvIa1mz8ehdvYiB09 q9aw5v1D5JjMfNyp+EfqFy8oNAvhFo3YIpl1w+GZXzjdCSxKvnBeqmHB5IBbqZrcXtgx zwcQ== X-Forwarded-Encrypted: i=1; AHgh+RoqdgEZ7SnsLjniJHsG9fkcpcWimF72WHY0BBZNXR8yL8X9uzM4e1eTVjXTMRjb3eDD6NP4CNP9ih/HgLU=@vger.kernel.org X-Gm-Message-State: AFuF++mfc0HbHfOOwjnm3NjkSRwHhVqOYVKlv74x1i1ZlrxuLrpg/Z9T RqtGTbDVFhx8cYc4PDf/XJfOBhGUVN/GauLpeKj8ZlqRdhdun7mR7rcG+Oa3JOQscw== X-Gm-Gg: AR+sD13vf3FHzFHm1KBk97Ey9KQE5fuM7ZSQQw7QTrJj00A8Jf9GsWpK44AIsXHhJ6/ U8irPPDnA6ELGJ1psia7xQGfz6Ndttp+ChA/ssIZXmZZ1pIHJZ7fEWbkt/C04xlVMtanCsv5Cg7 HngvyAvQgZr+KVElGqQpXsA2WoNk3yRRwqXkJ15W2Mqrlt8V7SHSvfC59GfBu/nuXUTeacddJoF X3C1DxYEkr9RB7dVUIgQx1Ow1AwtEQ053kgtmLMQTc8g7O9FyntcMMERg0mvWIEjPnre2TMCjau /LiYB4btxB2DNDhaoCTS7XNmyrjdsQGdvLAXbfGsOzBhseXEvnWSLyAUARTVfAyk2eavFaU6NOY IWCEZ2rguS6ny6oD1G6QtSRleTo2YKgVqcYWXb4PM8Skobn7gRvwKWAYISatvn72GoOSBGowDKs bummgr/v/KpFI7fgppNepAamxhdj0NAdFWeqbML7MYMNFXaroVEJWKXxy8RUgIVFD/yEcpa8B2u tAn+F1hp0te4PEdH1k4jv2YerByT2MBpkrwrSibj7aY2fvQEeDAUW/URWRtbJq9ibKe64WYuBNW L0L3JIVrtDAdLECtUrqPHy/69T9InNlNn0j6LZrLD7BlWRrKlVGMa+GHYRksfMCJMeDVn5sewPD cPc8027+Yr6hYd3cn6Q/4CdO5RPvhlPGu5JpZ9MRjQ72gp71knk8t0U04WHwoHEJFcBv9Oz9c X-Received: by 2002:a17:907:9629:b0:c24:d6f0:f4a with SMTP id a640c23a62f3a-c24d6f1021amr378846266b.10.1787581468455; Mon, 24 Aug 2026 07:24:28 -0700 (PDT) Received: from Desktop.fritz.box ([113.30.181.102]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c249672becesm1329890866b.42.2026.08.24.07.24.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2026 07:24:28 -0700 (PDT) From: Julius Bairaktaris To: jjohnson@kernel.org Cc: linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, linux-kernel@vger.kernel.org, toke@toke.dk Subject: [PATCH ath-next v3 1/9] wifi: ath11k: free tx skbs through ieee80211_free_txskb() Date: Mon, 24 Aug 2026 16:23:42 +0200 Message-ID: <20260824142350.1757379-2-julius@bairaktaris.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260824142350.1757379-1-julius@bairaktaris.de> References: <20260824142350.1757379-1-julius@bairaktaris.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" ath11k_dp_tx_free_txbuf(), reached from the HTT tx completion handler for the REINJ and INSPECT statuses, releases the frame with dev_kfree_skb_any(). Every other tx completion path in dp_tx.c hands the skb back to mac80211, and this one is the last that does not. A frame freed that way keeps whatever state mac80211 was holding for it. A data frame whose socket asked for tx status has a clone parked in local->ack_status_frames and an index allocated from an idr bounded at 8191 entries; ieee80211_free_txskb() releases both through ieee80211_report_used_skb(), and dev_kfree_skb_any() leaks them for the lifetime of the hw. Commit 29d15589f084 ("wifi: ath11k: Cleanup mac80211 references on failure during tx_complete") converted three sibling paths for exactly that reason and left this one. The leak also breaks AQL on a driver that advertises NL80211_EXT_FEATURE_AQL, which the next patch makes ath11k do. ieee80211_free_txskb() returns the pending airtime the frame was charged, through ieee80211_report_used_skb(), and dev_kfree_skb_any() does not, so airtime charged at dequeue is never given back. local->aql_ac_pending_airtime[] rises without bound, ieee80211_txq_schedule_airtime_check() stops starting a scheduling round for that access category, and no station on the radio is served in it again. Without that feature bit mac80211 charges no airtime, so a tree carrying this fix alone sees the leak and not the stall. Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices") Cc: stable@vger.kernel.org Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.9.0.1-02146-QCAHKSWPL_SILICONZ-1 Assisted-by: Claude:claude-opus-5 Signed-off-by: Julius Bairaktaris --- drivers/net/wireless/ath/ath11k/dp_tx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath11k/dp_tx.c b/drivers/net/wireless= /ath/ath11k/dp_tx.c index cac970c92806..52c4a9924a31 100644 --- a/drivers/net/wireless/ath/ath11k/dp_tx.c +++ b/drivers/net/wireless/ath/ath11k/dp_tx.c @@ -305,9 +305,10 @@ static void ath11k_dp_tx_free_txbuf(struct ath11k_base= *ab, u8 mac_id, skb_cb =3D ATH11K_SKB_CB(msdu); =20 dma_unmap_single(ab->dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE); - dev_kfree_skb_any(msdu); =20 ar =3D ab->pdevs[mac_id].ar; + ieee80211_free_txskb(ar->hw, msdu); + if (atomic_dec_and_test(&ar->dp.num_tx_pending)) wake_up(&ar->dp.tx_empty_waitq); } --=20 2.53.0 From nobody Mon Sep 28 08:04:53 2026 Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2347174C14 for ; Mon, 24 Aug 2026 14:24:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787581473; cv=none; b=gAkFUd+/Br1Mz8gBJ9/NytbHzrhqE7KahVkuwr7cQIdGrbATK5aIi3i+N2UWHzPn8vJHRGTuaTTZsSQ8shsxYDLuiOjQSIZx7/BM+R/Kic/AqyphVETw768WKjzOV7UGKtM029SzsxREPeXpLAMudz2++JEblPdfrK++UWeyutk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787581473; c=relaxed/simple; bh=vTc814XAlRbyqcyz0aglImjk3JKk8XWV6raVzMBMfiA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uCe0fGL4wacov6rKNpgHZzElHwACnQQha1YPJsyhaxKoi+lyLxuKFYLGX8I/X9aB2UbRxjrbASwCzkL3NBXH5HuHqK/F/sZeU6U85zsF0NsJMLkPUb9mxjolT70iJc5KAK2dn8Ak3VrTot9w81FXQy/EkNaV7Swy3iipaZzamtQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bairaktaris.de; spf=pass smtp.mailfrom=bairaktaris.de; dkim=pass (2048-bit key) header.d=bairaktaris.de header.i=@bairaktaris.de header.b=hwJ5YvLZ; arc=none smtp.client-ip=209.85.218.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bairaktaris.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bairaktaris.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bairaktaris.de header.i=@bairaktaris.de header.b="hwJ5YvLZ" Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-c15b1da6b82so377331666b.1 for ; Mon, 24 Aug 2026 07:24:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bairaktaris.de; s=google; t=1787581470; x=1788186270; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=KfowLqhDZunasKyUhow1L2/oi1+oZM/zPnoYhQBWbJo=; b=hwJ5YvLZYfUgFd9D2JAAEprNCbAWwwoU8FXsBIFa8qvJKB14Qymde9/SpDKYvoGUE9 e6fTVCPQ3Jg370giVRN6cYINLd3cEBPyNOiFoCWW06NnSL+R8UoIJN+gquYZeI9gY+Oq ib2S+4wtVzFk6caz62Edjej257mPH0R6RXoA7O8XLshT+t1IZ8FgzvDRcrxgIUBOozcy GJ2+jradJSnzdNhDFL3HqPI535YNOsDVPPcB97RXx/fKlRoWnv2qUMv39zGxxzZ4TXAR 5NKnnKexPHRlpQcAJJYqSnG1NKI/cLdPdxuCHHBta02yO6c6v9RAJVbKn51e+vAGbY4B jCmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787581470; x=1788186270; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=KfowLqhDZunasKyUhow1L2/oi1+oZM/zPnoYhQBWbJo=; b=KRKTTq89RnFKPvth/jOLG0h7ZavO1acDUYCquPgx0in+43mXC5W6K61paHzFYgntq+ 22pn4OPp3ywWR095th60Hs2S5F5i6SSV1K0ExpbhkYafI7QkOtWHyTYbO+LHwIKXCQII lXThr0kaBijNBE6N3U42BqXbzvGzNUe4PJSXekgTTmbiHkOD5SEteXCTkq5YcqDiwuLl zhyvXAn4Q/xyyPt5Z6aotDiLJn27bDhptrXMKoCUTxL0KCn0I5vFcAUWkdfOS2SE8mbi ponrdPgmJCbC9EbpHZtnYIZLf4kPjqOdEZVXzWNe1NR7Slyc2OelI7kVWOAuJnQeQfHQ AkJw== X-Forwarded-Encrypted: i=1; AHgh+Rq/IUAwCQ/k3sw5wVPUQa22dzUe+C27ZPPm1ILgGTysVgl9/GksWFNeJ/RbdN7Qw7Ey+V1ku/vi3jvAnHI=@vger.kernel.org X-Gm-Message-State: AFuF++m1Skudcgpu7F3zTxBvi5Nygs6i6fQThCCymVK6K9S3ES+ptXIw KDmzfEQNP/j/sndLW+iyhVtsLJjvnfDCEVm0eGsKw+dSVVp7/zx8ROf3f9JgxRZngQ== X-Gm-Gg: AR+sD10vZG9dGQ12Zm+SneYe6+8yjDoA6kM1cN+507gc66gD5fa3CfYfBGMArhX6v5U q0TtPYc+ymspdUh3PuYwuZEwXk65cAht0YM9HM18ykWEVqkXr9xwQSEQGTiHNIQsHOLcf4S5BOE 36SLgMMml7oIeL1u5OzTFKSleN0CkgYOBItwACWpNHX5TYfoDgux9PfWtwXA/Zv2+dfTuHWXgrf H7qRqLZOr7bTo0JqfXF4vrfJe0CNUigjQoy4jIkO60I8BLruQOx9cyVZ+ViGYjuWo8Ji5WBHYn7 JtjddaOwCHbuqr5zdBI1fXpCLztstedhM1q+YM6VM3C1mjYZkFxyL6TAu4xjywZymrad9YKK3PA 5iRWZuCcXIp1lh0vB7DtORucX5ANxzte526vtC2wZaAHoPVFmiNl9HUoAUpnCPTaCfFT9cj8G9F Kh6swuL+++qDqctd4kKH4b+34jBBTaHRgGE83cMDT7gwCwwIsOUirvxMlVqp5MwwSEPT2YJdpHo GZe23Ra5LMywkf3FHWyXbUG5zhpGTpvoQqqI4NcHDsDAiym0iQkQKxb6Fz6wzA6vru6nhwE/PCr rbsyxMiiOsgpIlHWFMwnsCFIbxI2tpVGQ6q+Yv7vnxVPxpdvZmAyRIRqoaNvTyJ3oM0UjQu9EMj B7x8nZkNb9erlDLj/FpcVWxu2RuEIZcn+/s4Km2Cx04Ilo8g0QQHfMiMp3fZBkBcNHSK6wifo X-Received: by 2002:a17:907:cd07:b0:c24:b11c:6c05 with SMTP id a640c23a62f3a-c24b11c6ce6mr1396610166b.14.1787581469243; Mon, 24 Aug 2026 07:24:29 -0700 (PDT) Received: from Desktop.fritz.box ([113.30.181.102]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c249672becesm1329890866b.42.2026.08.24.07.24.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2026 07:24:28 -0700 (PDT) From: Julius Bairaktaris To: jjohnson@kernel.org Cc: linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, linux-kernel@vger.kernel.org, toke@toke.dk Subject: [PATCH ath-next v3 2/9] wifi: ath11k: enable airtime queue limits Date: Mon, 24 Aug 2026 16:23:43 +0200 Message-ID: <20260824142350.1757379-3-julius@bairaktaris.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260824142350.1757379-1-julius@bairaktaris.de> References: <20260824142350.1757379-1-julius@bairaktaris.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" ath11k does not advertise NL80211_EXT_FEATURE_AQL, and every user of AQL in mac80211 is gated on that bit: the airtime charge in ieee80211_tx_dequeue(), ieee80211_txq_airtime_check(), ieee80211_sta_update_pending_airtime(), and the per-station aql file in debugfs, which is not even created. That matters here more than it would elsewhere, because AQL is the only brake. ath11k uses ieee80211_handle_wake_tx_queue(), whose wake_tx_push_queue() drains a selected txq whole into the driver, and the check at the top of ieee80211_tx_dequeue() is what stops that drain. Without the feature bit nothing does, so mac80211 holds no backlog and every queued byte of a saturated download sits in the hardware TX rings, where there is no AQM and no flow separation. Measured on an IPQ8074 AP against one HE 160 MHz station at MCS 11, taken from that station's own aql file while it received 280 Mbit/s: its BE queue depth reaches 6356 us of the 12000 us default limit, and 2972 us when the limit is lowered to 500/1000 us. Pending airtime stands above the limit it is tested against because ieee80211_txq_airtime_check() admits a frame while pending is still below it, and the TIDs of one station test it independently. Without this patch the file does not exist and the limits are never consulted. The rate the estimator needs is already there: ath11k keeps a per-station rate_info in arsta->last_txrate and passes it to ieee80211_tx_status_ext(), which stores it as tx_stats.last_rate_info, and that is what ieee80211_calc_expected_tx_airtime() reads. Where no rate is known yet the estimator falls back to its 4 us floor, so a station's queue is charged the minimum until the first HTT PPDU stats arrive and the per-AC limits of 5000 and 12000 us stay loose over that window. The current code charges nothing and consults no limit at all, so nothing is held back that is not held back today. A rate that has gone stale low overcharges a station that has since sped up, bounded by the same lag. The estimate is only as fresh as arsta->last_txrate, which is updated from the HTT PPDU stats when a descriptor is evicted from ar->ppdu_stats_info, so the rate behind it can lag a rate change by up to HTT_PPDU_DESC_MAX_DEPTH PPDUs. ieee80211_sta_update_pending_airtime() returns the airtime but does not reschedule the txq, and ath11k has no completion-side push, so a queue held back by AQL is re-poked only by the next enqueue or queue wake. The bit alone brakes the queue but does not refill it: the check at the top of ieee80211_tx_dequeue() stops the drain, and nothing restarts it until mac80211 next calls the wake_tx_queue callback. Later patches in this series give the driver a scheduling round and run it from tx completion, which is what makes a binding limit affordable. ath10k and mt76 set the same feature bit. Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.9.0.1-02146-QCAHKSWPL_SILICONZ-1 Assisted-by: Claude:claude-opus-5 Signed-off-by: Julius Bairaktaris --- drivers/net/wireless/ath/ath11k/mac.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/a= th/ath11k/mac.c index 2d55cdc4d165..38f641bbc53c 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -10592,6 +10592,7 @@ static int __ath11k_mac_register(struct ath11k *ar) ar->hw->sta_data_size =3D sizeof(struct ath11k_sta); =20 wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST); + wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_AQL); wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_STA_TX_PWR); if (test_bit(WMI_TLV_SERVICE_BSS_COLOR_OFFLOAD, ar->ab->wmi_ab.svc_map)) { --=20 2.53.0 From nobody Mon Sep 28 08:04:53 2026 Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 952FF34C9A6 for ; Mon, 24 Aug 2026 14:24:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787581474; cv=none; b=duleoJfJCinnGRycepZ3K72+ExhtOifJDZ/SJMVMlIW8znS10tHtrpwuI1Ao9270tJPlME6aZXMtVTnQbUDwYD8D7DwYh/9JtDuu7VPPWeHhd4YCZfPaBuqBxDn27FPOWMVFr02NPj/Avuchhlg+Cux80ZTXvS+3Xphzeyz3RHk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787581474; c=relaxed/simple; bh=8aX8jcwue7vsqzSOH5L6v0CdUfBEnLitNpQPDNzgBf4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tb9Ioz4g7cpqOXRQUbFVnRhrrQ/nFoapUqVDysw6B9Zh6d+2nWb4sQcxS2J3i9GHNoXanj6CjMsTemDWn+bay1a5WQFPQwU3/TyO8FP+BheWzKC4rCoZaM14FOROI0MrrJyekrQMzaph21lSgkjgrxjGzi1xAjWbSjWomGjjopM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bairaktaris.de; spf=pass smtp.mailfrom=bairaktaris.de; dkim=pass (2048-bit key) header.d=bairaktaris.de header.i=@bairaktaris.de header.b=eL0A0IM6; arc=none smtp.client-ip=209.85.218.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bairaktaris.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bairaktaris.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bairaktaris.de header.i=@bairaktaris.de header.b="eL0A0IM6" Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-c1677c91969so429176866b.1 for ; Mon, 24 Aug 2026 07:24:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bairaktaris.de; s=google; t=1787581471; x=1788186271; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=ZXlIR70MotY7OfT34O+UemzHWb+H2mqTXl+J9INafOM=; b=eL0A0IM6DmjckMnLoVjWfI7peEuBXc1Fj1Wp9+eP3EHj6dSK+wK8pQQHRAz57a566L MX1UjR5LUEDQDZuxmONSchrqzjAY/CkFIiuC0Jw51paKu2MFsua9lAOHpF4jhlItuWOa 2j3d8vZ5M9LUahaXjyOe8DoyaMOG1bPYVLT69IyEJm7BVH0zJjGQTwaZ37n63zc/McUm YmAXPMBy6Q0C0kF7zM/il4uBmzLiN0H9FnTABKgdGmpXyFKLR6Qsn6Fgk44org4Im7Rl OH92T5EOqj1X1ArwcxGTEmBYZK2EzM1Ioa/QMzxPKiyzTppbD43UI0CrrXCykhW0SjHI I7ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787581471; x=1788186271; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=ZXlIR70MotY7OfT34O+UemzHWb+H2mqTXl+J9INafOM=; b=qs9abhAd1tmAyQLwFrACdeXqGIkWv3TGaS0DO1M0QlyCT8uZvDgIyCZeMn7fJUodbt 4nBukwQE8JUrbXyy3EtKKNh+eFnZqAKisTy7T6QnhHFHNsn/J/+LbjwfOh6rh4oOvfTi q+P/7QyQaz046e9Mv9RZKQ8/7bUgPfhWWaIqFF1dmqVDzCwdc1Ng9iyKC8J/HGy/lxHB Mz9z83iAcFpxGqW39JL0pGtzxwcnB5q6PMdUq8gAPKVd0EV7DF6aim4aWxP4tK9dWm9s H6heJrk1kdsGEKcEPJkb4MNrtBjF5e6mZX0xDDpB3mNJE1K1BGhgZl+liCRqraO1aUdS G2pw== X-Forwarded-Encrypted: i=1; AHgh+RqvpoqJeymcv1QBLI+opymEWvROrOx3zevg3GGT//4GDfK92zSaCYhCKdBgog2gpgHGcmzO/0jaxxg7YuU=@vger.kernel.org X-Gm-Message-State: AFuF++lOpLEpfzIwkUDg48d5lK05cZ3wL0znil6ckrffFZpyf1plYK2j GSiIwd4e/DMZIki3LiSPpjRWnQIkOqYY2hbAsCmGJ+oag13yqu/wVm27ck203Hz0gGQU+9EmH3D S2wKjpk75 X-Gm-Gg: AR+sD10Hk0NE1LQhQHsRHoqfzkB0GLe5aejTWk438Q1Fa30fc8wu55n+A0RB9pwurNY RErSwxEuQM55FmjS1pC3W8DNykaGBgSEu2hih6U8tYutdZ2SzRGtdCKEVxPRtb5NC52XyN0Ivq8 zSTcAp4m+XjJuusF4ZPJzA/MJ0sCmOlyO6YmM2MZRXZuuTHqq8zmiW1h6sSMc6r3xPtSqpMsH02 9vYlMMBFEeaDd03PVWbeAs7/XnYF/d5LdxwgxvpMEO4QRQ0z3HNRoK4ps/pogeV5WB21rZZcJi+ Ts9tzDVJ0Cnq2HWLO4dHkOxYVZs3BCWaR8fh8bURydBpAVLbNSXMcU8Txtls9jvncXHOUtv9bWC DJNR8jpMRv9rxl5xI148z2DpEwX6e+rrghOgpMxvELXIaibNM8cFiNrH+0/LQZ8QM0ExqPGGIqR SlJf2ksudCL+74djCG1qGZstAg/Zv/xILPJvwtkvUJhcnCOuSGmyI7DgG6/7qUxpIYgB1hCTbWp C+dh8mWWZWFPCJ4xgwqepcnWfEOl4anHbVgdrhVBTmYkbT2WPzgVkJqbUX9Ctrq8RtOlI4GQsmx O7XGne3GFMvsICEDhxDX4V12DkgSL+YRrd0nTxPA8hAfqK6PJk4Je3x/IdiFnm9zA5q9D7/EnoY /bOosJNpqqKntA8Fu3Tnf6Ic0wcbXQWJKoOZOrDNzuNv7F6WnMIkDc0sY45mu0TRwwP1nPOxX X-Received: by 2002:a17:906:6312:b0:c24:6445:d19 with SMTP id a640c23a62f3a-c24926f3cf9mr2273907166b.17.1787581470246; Mon, 24 Aug 2026 07:24:30 -0700 (PDT) Received: from Desktop.fritz.box ([113.30.181.102]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c249672becesm1329890866b.42.2026.08.24.07.24.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2026 07:24:29 -0700 (PDT) From: Julius Bairaktaris To: jjohnson@kernel.org Cc: linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, linux-kernel@vger.kernel.org, toke@toke.dk Subject: [PATCH ath-next v3 3/9] wifi: ath11k: report the pending tx MSDU count in soc_dp_stats Date: Mon, 24 Aug 2026 16:23:44 +0200 Message-ID: <20260824142350.1757379-4-julius@bairaktaris.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260824142350.1757379-1-julius@bairaktaris.de> References: <20260824142350.1757379-1-julius@bairaktaris.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" ar->dp.num_tx_pending counts the MSDUs the hardware has not completed yet, and is used to wait for the transmit path to drain. It is never shown. soc_dp_stats can therefore say when the transmit path overflowed - TCL ring full, misc transmit failures - and not how deep it is at this instant. The bound those counters report against is the tx descriptor idr, one entry short of DP_TX_IDR_SIZE per ring, which is large enough that occupancy rather than exhaustion is what characterises the path under load. Print it per radio, beside the failure counters it complements. Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.9.0.1-02146-QCAHKSWPL_SILICONZ-1 Assisted-by: Claude:claude-opus-5 Signed-off-by: Julius Bairaktaris --- drivers/net/wireless/ath/ath11k/debugfs.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/wireless/ath/ath11k/debugfs.c b/drivers/net/wirele= ss/ath/ath11k/debugfs.c index 70922612d3fb..9dc586b68136 100644 --- a/drivers/net/wireless/ath/ath11k/debugfs.c +++ b/drivers/net/wireless/ath/ath11k/debugfs.c @@ -714,6 +714,18 @@ static ssize_t ath11k_debugfs_dump_soc_dp_stats(struct= file *file, "\nMisc Transmit Failures: %d\n", atomic_read(&soc_stats->tx_err.misc_fail)); =20 + /* What the hardware still owes a completion for. The counters above say + * when the transmit path overflowed; none of them says how deep it is. + */ + len +=3D scnprintf(buf + len, size - len, "\nPending Tx MSDUs:\n"); + for (i =3D 0; i < ab->num_radios; i++) { + struct ath11k *ar =3D ab->pdevs[i].ar; + + if (ar) + len +=3D scnprintf(buf + len, size - len, "radio%d: %d\n", + i, atomic_read(&ar->dp.num_tx_pending)); + } + len +=3D ath11k_debugfs_dump_soc_ring_bp_stats(ab, buf + len, size - len); =20 if (len > size) --=20 2.53.0 From nobody Mon Sep 28 08:04:53 2026 Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CA805439F93 for ; Mon, 24 Aug 2026 14:24:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787581474; cv=none; b=hnX7YRMsY/wmXg2mZ7ulyatocPTrRUIG/6FQ+M1y0pJIf0pP94C5Yfenc9YKyzFWHW31fE58W0Q5E1djb5jyxJEip2zs2mRJNGRBRKHaf8sQcm/BZjZ90NiPVJEcNfl2i05kMg8WOE4J+6TBOYsOONALqmfD+/Sd9lGE6qdIjbk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787581474; c=relaxed/simple; bh=Vutdc8gNGEiDSB/PvBkPav8VKriNXv1N6grQ/8mvoeQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CRB7+J8Khr4NCPxdfY3mDZx9ws08FQ5wU+WPWljJJt6AIly8qlise8V5PDEh+hU1sZiZ2WRPil30Tkno8hhXlVZwHMZMBRpifLrDukQyk/Xz6qGr+4PiuHgFHTHAZ6wtsLKWy8Zy1b6gmSLEZ7LAU5t7rFKBmrG8GF23iLO/d5k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bairaktaris.de; spf=pass smtp.mailfrom=bairaktaris.de; dkim=pass (2048-bit key) header.d=bairaktaris.de header.i=@bairaktaris.de header.b=YQxBALvY; arc=none smtp.client-ip=209.85.218.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bairaktaris.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bairaktaris.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bairaktaris.de header.i=@bairaktaris.de header.b="YQxBALvY" Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-c15f020a223so520990766b.1 for ; Mon, 24 Aug 2026 07:24:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bairaktaris.de; s=google; t=1787581471; x=1788186271; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=X6pRZ9lo49gs2yifUnauSOrX6fxKPA05MA7r7zA0lK4=; b=YQxBALvYe/G1eEX4ofkVR0QrEozq9Sw6ZE55C2ruxe0dK9P0KSc3eSMx6UiiJJ9KnY 1e5v5TnFFmu4dxZ/kwuN8nJCt3nRn5vgS9P4lTHtiSvnvSsXBtLQeVm/lyP0QWSLbS8R usTwn850EZci/MFGji1MKf6C2gEMSq2+ylXm+FBety0QF/KuFSLduFnsjKGyGSPbZc5G urVxG8lXQ8OyBzjrdoSSX5ubf7UF5wsQ0fPhP89n1YxtlgFRXXCHVMYuw1nT5JR++3j/ Sn3gNe3AfSToallxzF59X30/7fVtLrz/HrwJqTg0jAsviU64n59xRYL7oII3BKNUbLu3 bxJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787581471; x=1788186271; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=X6pRZ9lo49gs2yifUnauSOrX6fxKPA05MA7r7zA0lK4=; b=piA6sKa1xreW2tzdkc7TVMrnhVk5f8TeH8OVn60t4AKNCr+GSnOdpGN06enHQlCNia Kcxiy2wH1wbbFZrJuXGOP6/Mnp8dy4qVeeI/+oDINQ8w3OC9s6j2854p5AlO8axWl1FE 2EHVv16TFS/x+Axbz+sTrOvaeXb54wZ1xb6FYTq9lL6YZsQeyQaYWMWpapWA4RNQtRDy kOTPQCXQJ8Mp7zxXKpoDO2Wah8QY8Gmfd3VK16DnOKXq+S1gDBKwGdzlg2sb0/81ijoq 8kuvqpwtSkqpoyWeFIK5FckverQAg2JdHqkX+IzPrfEQdmFDDJXnNksI03xlbzDBGVSV S03g== X-Forwarded-Encrypted: i=1; AHgh+Rrbs3UCfo8hVnqBQUK4WApcRzSPHXAvPnprLjU+22Vz74YWOTp3ZTCKUl7xpvXEYHHdgWmRuYEXqasrPcg=@vger.kernel.org X-Gm-Message-State: AFuF++lF4yD+99qp8LsUVnulT44ulV2xoYExOeJ5FeE/AVvrhWWDoZ1A 9vBQsNXlhAKPCeJN8mZcU/+O7VIZZq6qftEnj4RMPpqEM7qpW+SNbvJTKCTdztYWhg== X-Gm-Gg: AR+sD11w89JpwhTfkuFYHGGibl3zj+KLXAcG7yhz1D2vDOzXH83/SvA2SjZ5kcXa2Vc gvS5qYcewIIjV69ImmtHwNy0arn+8lRTFnZEXXzinScl4NRia5QV4MVE9NvQ2zYApBiRoIoShlR oyoFQCpleJPEnwN1/Faeokmb1bq+S1ZEIz18morRi4Mu/RHI2jT6q4Ey1KsA8OmSUrOa2pu6IUl mlnrNXG+fj39G3NYW/5Q6lzKSVth3GX5M1AqfpeG+k1jH6lMTDnS25LCNLthgOB9qDshVzwHDbM b3KMz5IuNrNNHUid0ksikUawHAjXpLV6RIe59EbX2whbtPP4JUCiXa8S5AQNv2S4ZT51LDLo9uQ fhTYtrdpN37zgv2UbzqJYXBtpKAosfWRKMPgDtpnG4h9JxqeBISxGaFaAJJlXoEopX5/CPTnMBP 9fBR7yY4KcAO2rIJFrEDgxwpcKoPtWiB3LPFS6IZYjGvhGcTCO1y7JWXgiL3fggY0284dli+9Ds OFeUwKyqB5wy4okSBlYurRkna8CoIO3R0PNEHPlonCvneFXNqUWN7GZWjqZ9NuaHTwp2d1rrSNT nLNX6WycNa07UZFwN6K+o4b2eoVBHdzv4KSUpPdI0D+sRsDJPFPXrAZ1TyltQtXxrp8akMsc4GF L39JXnvDwQiN0+/5AHU7oPlWLKpIa4nuCayEWU/H1guR2aXNy5vq2gFQv2ujOIjObNhKmFOIU X-Received: by 2002:a17:907:7283:b0:c24:b11a:470f with SMTP id a640c23a62f3a-c24b11a493emr1213893666b.0.1787581471018; Mon, 24 Aug 2026 07:24:31 -0700 (PDT) Received: from Desktop.fritz.box ([113.30.181.102]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c249672becesm1329890866b.42.2026.08.24.07.24.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2026 07:24:30 -0700 (PDT) From: Julius Bairaktaris To: jjohnson@kernel.org Cc: linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, linux-kernel@vger.kernel.org, toke@toke.dk Subject: [PATCH ath-next v3 4/9] wifi: ath11k: report tx airtime and enable airtime fairness Date: Mon, 24 Aug 2026 16:23:45 +0200 Message-ID: <20260824142350.1757379-5-julius@bairaktaris.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260824142350.1757379-1-julius@bairaktaris.de> References: <20260824142350.1757379-1-julius@bairaktaris.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" mac80211's airtime scheduler charges sta->airtime[ac].deficit from one place, ieee80211_sta_register_airtime(). Unlike AQL there is no estimator fallback, and ath11k never calls it, so the ATF feature bit cannot be advertised on its own: the deficit would only ever be replenished, every station would stay permanently in credit, and the DRR would be inert. The bit is not a no-op in that state either, because it also moves txq insertion to the head of the active list, which __ieee80211_schedule_txq() documents as safe only because the DRR moves a station back once its deficit goes negative. fes_duration_us arrives with every PPDU's stats and is already accumulated into arsta->tx_duration a few lines above. Register it, and set the feature bit in the same change so the two cannot be separated. The access category the airtime is charged to comes from the TID, and the ack/BA status TLV that ath11k took it from is emitted only for a PPDU that drew a response. A transmission that timed out, was filtered or was aborted names its TID only in the completion and rate TLVs, both of which already reach the driver and were read nowhere. Take the first of the three the firmware supplied that names one of the sixteen QoS TIDs; a PPDU that names none is charged to best effort, the access category mac80211 queues a frame without a QoS TID in. Measured on an IPQ8074 AP with two stations on one radio, a 1x1 VHT client and a 2x2 HE client, both receiving at once. Before, 'iw station set airtime_weight' is refused with -EOPNOTSUPP and the per-station airtime file reads zero. After, the weight is accepted and read back, TX airtime accumulates, and the per-AC deficits move. What the deficit can do with that is bounded by how the driver hands frames to the hardware, which the following patches change; the airtime share this alone produces is reported with them rather than here. fes_duration_us spans the frame exchange sequence, so it includes the SIFS and the responding BlockAck, time the radio spends receiving; the airtime registered is therefore larger than the airtime transmitted. It is also a per-PPDU field, so on a downlink MU PPDU each user is charged the whole sequence. No per-user duration is reported in these stats. On the firmware tested here every PPDU carried exactly one user, measured over 21051 PPDUs, so the MU case is latent rather than observed. Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.9.0.1-02146-QCAHKSWPL_SILICONZ-1 Assisted-by: Claude:claude-opus-5 Signed-off-by: Julius Bairaktaris --- drivers/net/wireless/ath/ath11k/dp_rx.c | 20 ++++++++++++++++++++ drivers/net/wireless/ath/ath11k/mac.c | 2 ++ 2 files changed, 22 insertions(+) diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless= /ath/ath11k/dp_rx.c index 33425707c084..28aaf39cf342 100644 --- a/drivers/net/wireless/ath/ath11k/dp_rx.c +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c @@ -1377,6 +1377,7 @@ ath11k_update_per_peer_tx_stats(struct ath11k *ar, u16 rate =3D 0, succ_pkts =3D 0; u32 tx_duration =3D 0; u8 tid =3D HTT_PPDU_STATS_NON_QOS_TID; + u8 airtime_tid; bool is_ampdu =3D false; =20 if (!(usr_stats->tlv_flags & BIT(HTT_PPDU_STATS_TAG_USR_RATE))) @@ -1485,6 +1486,25 @@ ath11k_update_per_peer_tx_stats(struct ath11k *ar, =20 arsta->txrate.bw =3D ath11k_mac_bw_to_mac80211_bw(bw); arsta->tx_duration +=3D tx_duration; + + /* The ack/BA status TLV is emitted only for a PPDU that drew a + * response, so a transmission that timed out, was filtered or was + * aborted names its TID only in the completion and rate TLVs. Take the + * first of the three the firmware supplied that names one of the sixteen + * QoS TIDs; a PPDU that names none is charged to best effort, the access + * category mac80211 queues a frame without a QoS TID in. + */ + airtime_tid =3D tid; + if (airtime_tid >=3D IEEE80211_NUM_TIDS && + usr_stats->tlv_flags & BIT(HTT_PPDU_STATS_TAG_USR_COMPLTN_COMMON)) + airtime_tid =3D usr_stats->cmpltn_cmn.tid_num; + if (airtime_tid >=3D IEEE80211_NUM_TIDS) + airtime_tid =3D user_rate->tid_num; + if (airtime_tid >=3D IEEE80211_NUM_TIDS) + airtime_tid =3D 0; + + if (tx_duration) + ieee80211_sta_register_airtime(sta, airtime_tid, tx_duration, 0); memcpy(&arsta->last_txrate, &arsta->txrate, sizeof(struct rate_info)); =20 /* PPDU stats reported for mgmt packet doesn't have valid tx bytes. diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/a= th/ath11k/mac.c index 38f641bbc53c..40a2b6d2f804 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -10593,6 +10593,8 @@ static int __ath11k_mac_register(struct ath11k *ar) =20 wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST); wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_AQL); + wiphy_ext_feature_set(ar->hw->wiphy, + NL80211_EXT_FEATURE_AIRTIME_FAIRNESS); wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_STA_TX_PWR); if (test_bit(WMI_TLV_SERVICE_BSS_COLOR_OFFLOAD, ar->ab->wmi_ab.svc_map)) { --=20 2.53.0 From nobody Mon Sep 28 08:04:53 2026 Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7ACA043BDA3 for ; Mon, 24 Aug 2026 14:24:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787581476; cv=none; b=tJFHMnI45MIgmE5ueP30aCLzBUFnAgnBQbBy/lMxWVL7aumKzzK19gK5LW1uTWY7CeHWckiPBB23XrVZnKHiVGjYbWE0QS8Kl+/u9UzLDAovkN8BuDKU2pscCvCNglI/w+I9sssv9e7cyjs88XDZEBw3xI0748mTSFp0+9Mva8Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787581476; c=relaxed/simple; bh=YN6Koz+u9VujQLvhAZxVbZHkNBDhoWuJgZ7WalFj2hk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nfOrd6nyFqKZkZApV1z1aN35U8c1IKxGGoYzrlA9KSIOBFGYbEKEGEYi0KoPkkIuvNqLnQJl7MBrhNWnvMPRsV/aoO42lVua1l3MTeGhfqQqQHXzCnRcPrG+OwRgaw3ku6JlQDp7B/dbqgvRMPQGMojWiTcLjhHs2bnOkedzSI4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bairaktaris.de; spf=pass smtp.mailfrom=bairaktaris.de; dkim=pass (2048-bit key) header.d=bairaktaris.de header.i=@bairaktaris.de header.b=lahSE0ni; arc=none smtp.client-ip=209.85.218.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bairaktaris.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bairaktaris.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bairaktaris.de header.i=@bairaktaris.de header.b="lahSE0ni" Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-c15b1da6b82so377337366b.1 for ; Mon, 24 Aug 2026 07:24:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bairaktaris.de; s=google; t=1787581473; x=1788186273; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=TEHKshZ50VF+vld2tceM1/dTFTvHUFhobWJ0AfZzzco=; b=lahSE0niRdUINgeY5Te7RLS0fCybUrgmVBFQ7a6iYa5YLVLlolmWD2kSxcRCT3xdpW v4LnsypTHCGuRPKjo3zvFJD3Wuh1y8kbretgCGg3lpGk4+0D17KS1bRIbwA5tpw+4xbX rFojiKC06ra/qjo5+fLh6o4oagZxsN/iNmB9FsLUakOR2rjhXaa45zFNVKdc0BVf5Ndb +72EosDIuCfP6EY+aHtRVSuJoW4yG9Su+d54+inq+iilmxpQmz3Joe9IqKFiSWwtn1rm BaJN+BceIjEos9FWsI/G2zAtxRtZ0M1c+WdPM0dslgoMgp9Y3ar9zalVhHU1qCTTpD0i 1JKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787581473; x=1788186273; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=TEHKshZ50VF+vld2tceM1/dTFTvHUFhobWJ0AfZzzco=; b=ZXLNuLF11ohoYRq4KhGgWgoP9me/3RPz9q+/y5h+zdSGM7Incbw2SeI17Ii2cyyw+g 8Wk6zhW7RjgGWGt0TGuJAynuvyxoju/byCe7QS3IkSAZpnJaUWT6ytXJ2gGZNgWu0cvp yIw54/bzFcZX+vNkAB7g+246w2VEhZrUrI4XKyZiq2Kn7nhd9x9/IBl0Z2z7kbl9Bv0K 3Cx1aaSlvaiuFCsZ9lnWEjdN+Q2FLHHDVMUd8g/FDRumtMYrAECoW8W4UAtHtDP/KcHY WnMHgeD4xT8bRo796pPkvEfejp062YBy6pRT/Mmq5m5Vh4DyyuOYwMw7KR/uL9/I6L17 igiQ== X-Forwarded-Encrypted: i=1; AHgh+RorJWkWfYiyPNvQNlcSFQKwj48l8WYP+LsJbJ4FOX+R5KJ9kzPcEdU2OJBTRxcHg4kY9i/HRBwGz5Wazdo=@vger.kernel.org X-Gm-Message-State: AFuF++lHnJSfi59NL6PiRoN1c2WtMugamifKehmWA4QkYewjk6iIpjS9 vAUlz4BIQzbN5nx11fxb0f45PQEMPeajpTxQ/u3BcKlAR9EQ4M6v63kwIG6fuB251Q== X-Gm-Gg: AR+sD13Kng3DKQtj2pkxF9eUU2njvJTaDkGyRVAu9GtWpu/XbrSfffI3kMIhg0Wwqcs e8CyvK+pKCgNOrP3wWzt3PUNwSkGfgp5vqQIv6WIt+iyGW79EEaqU6eS/5J7naS9DrCdo4fVX3o XDsLLiKXRKfnCztcExDIIXSlKnnNEW/rwDQdFwC8ab8Opk8lO0Gg94dxX0uBsrgHXOB0kJJ6f30 RC9XiN6pqJ61/EuLqMSr1BQ0QwxU+lAcdFQTYxFOu4xEJqmmkL6zCWldg4pvLupcq5PsZAAwLFF Ya6ZQHqwiTXOmutv6Jli/3bV9IG/3xGrpRouYw5GkPCZzmwFDdy5Oj8LA7klnDmv7RDRQF4p9vq t/HxUaaW+YOjOYrZAASVSIsNKHM3o5f8/8tkrIP80H5fBns90flpBRlLsJptM9tMWwkB0dM7n4h MPQUijXCrd5TC8akgW2qJwUzOINBnoupuF30a5QhGgaZhiCOZZ8atiAKt5FZU/BnQGo5woM+RsQ BI6qwpXVRKYcJUTL23O4z19orTpnTBfdvyWAvFoJw1cmVmqbpKkThVdOVvnDzWN2ZJRRF6Ikmj0 qG4EOm1UOMN/Fibejsya9+Rb9uKbTnZdb8Ie10hU0WkdWZReDQh+o1BH75AZDfAc0c5KnnuLGuu 4vYWLGJn0V1BkiSKyWFzmwznQEqAmGj0MG7Ry/Bsuj3xYiFVM/mWrFv6Xrn8k4jzd+IZ3s5nVZX gq//kbip4= X-Received: by 2002:a17:907:c706:b0:c20:f913:9337 with SMTP id a640c23a62f3a-c246a657f9fmr3239680366b.20.1787581471726; Mon, 24 Aug 2026 07:24:31 -0700 (PDT) Received: from Desktop.fritz.box ([113.30.181.102]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c249672becesm1329890866b.42.2026.08.24.07.24.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2026 07:24:31 -0700 (PDT) From: Julius Bairaktaris To: jjohnson@kernel.org Cc: linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, linux-kernel@vger.kernel.org, toke@toke.dk Subject: [PATCH ath-next v3 5/9] wifi: ath11k: schedule TXQs from the driver Date: Mon, 24 Aug 2026 16:23:46 +0200 Message-ID: <20260824142350.1757379-6-julius@bairaktaris.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260824142350.1757379-1-julius@bairaktaris.de> References: <20260824142350.1757379-1-julius@bairaktaris.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" ieee80211_handle_wake_tx_queue() has exactly one entry point, the wake_tx_queue callback, so a round starts only where mac80211 calls that callback: a frame arriving from the network stack, a block ack session starting or stopping, a station leaving powersave, or a stopped hardware queue restarting. Every round runs under local->handle_wake_tx_queue_lock, which is shared by all four access categories of the hardware. That is the wrong shape for a driver whose only backpressure is the airtime queue limit. When ieee80211_txq_airtime_check() refuses a station, ieee80211_tx_dequeue() stops handing out frames and the station's intermediate queue keeps its backlog until the next enqueue, not until the airtime it is waiting on comes back from the hardware. Returning that airtime does not reschedule anything. Open-code the round in the driver so that a second context can drive it. The walk is the same deficit round-robin over the active TXQs of one access category that the generic handler performs. A selection ends where the airtime queue limit binds, because ieee80211_tx_dequeue() applies the limit itself, and drains the station's queue where it does not, which is what the generic handler does today. mac80211 documents that a driver must not run concurrent scheduling rounds, and the next patch adds a second context that starts one. The round therefore takes a per-category lock rather than the hardware-wide one. ath10k and mt76 also drive the round from the driver; ath10k takes its per-category lock on the wake path alone, and mt76 serialises instead by running its rounds from one per-device tx worker. A custom .wake_tx_queue with a tx-completion driven push was proposed for ath11k once before [1]; the design was right and the measurement that justifies it is in this series. Link: https://lore.kernel.org/all/20230501130725.7171-1-quic_tamizhr@quicin= c.com/ [1] Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.9.0.1-02146-QCAHKSWPL_SILICONZ-1 Assisted-by: Claude:claude-opus-5 Signed-off-by: Julius Bairaktaris --- drivers/net/wireless/ath/ath11k/core.h | 5 +++ drivers/net/wireless/ath/ath11k/mac.c | 44 ++++++++++++++++++++++++-- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/= ath/ath11k/core.h index a0d725923ef2..40895d276de5 100644 --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h @@ -709,6 +709,11 @@ struct ath11k { */ spinlock_t data_lock; =20 + /* serialises one scheduling round per access category against the + * other contexts that drive it + */ + spinlock_t txq_lock[IEEE80211_NUM_ACS]; + struct list_head arvifs; /* should never be NULL; needed for regular htt rx */ struct ieee80211_channel *rx_channel; diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/a= th/ath11k/mac.c index 40a2b6d2f804..342b38308468 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -6546,6 +6546,43 @@ static void ath11k_mac_op_tx(struct ieee80211_hw *hw, } } =20 +static void ath11k_mac_tx_push_txq(struct ath11k *ar, struct ieee80211_txq= *txq) +{ + struct ieee80211_tx_control control =3D { .sta =3D txq->sta }; + struct sk_buff *skb; + + /* ieee80211_tx_dequeue() applies the airtime queue limit itself, so a + * selection ends where that limit binds, where the hardware queue is + * stopped, or when the queue empties, as the generic handler does + * today. + */ + while ((skb =3D ieee80211_tx_dequeue(ar->hw, txq))) + ath11k_mac_op_tx(ar->hw, &control, skb); +} + +static void ath11k_mac_schedule_txq(struct ath11k *ar, u8 ac) +{ + struct ieee80211_hw *hw =3D ar->hw; + struct ieee80211_txq *txq; + + spin_lock_bh(&ar->txq_lock[ac]); + + ieee80211_txq_schedule_start(hw, ac); + while ((txq =3D ieee80211_next_txq(hw, ac))) { + ath11k_mac_tx_push_txq(ar, txq); + ieee80211_return_txq(hw, txq, false); + } + ieee80211_txq_schedule_end(hw, ac); + + spin_unlock_bh(&ar->txq_lock[ac]); +} + +static void ath11k_mac_op_wake_tx_queue(struct ieee80211_hw *hw, + struct ieee80211_txq *txq) +{ + ath11k_mac_schedule_txq(hw->priv, txq->ac); +} + void ath11k_mac_drain_tx(struct ath11k *ar) { /* make sure rcu-protected mac80211 tx path itself is drained */ @@ -10067,7 +10104,7 @@ static int ath11k_mac_op_sta_state(struct ieee80211= _hw *hw, =20 static const struct ieee80211_ops ath11k_ops =3D { .tx =3D ath11k_mac_op_tx, - .wake_tx_queue =3D ieee80211_handle_wake_tx_queue, + .wake_tx_queue =3D ath11k_mac_op_wake_tx_queue, .start =3D ath11k_mac_op_start, .stop =3D ath11k_mac_op_stop, .reconfig_complete =3D ath11k_mac_op_reconfig_complete, @@ -10757,7 +10794,7 @@ int ath11k_mac_allocate(struct ath11k_base *ab) struct ath11k *ar; struct ath11k_pdev *pdev; int ret; - int i; + int i, j; =20 if (test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags)) return 0; @@ -10791,6 +10828,9 @@ int ath11k_mac_allocate(struct ath11k_base *ab) =20 pdev->ar =3D ar; spin_lock_init(&ar->data_lock); + + for (j =3D 0; j < IEEE80211_NUM_ACS; j++) + spin_lock_init(&ar->txq_lock[j]); INIT_LIST_HEAD(&ar->arvifs); INIT_LIST_HEAD(&ar->ppdu_stats_info); mutex_init(&ar->conf_mutex); --=20 2.53.0 From nobody Mon Sep 28 08:04:53 2026 Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2F5F943C07C for ; Mon, 24 Aug 2026 14:24:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787581477; cv=none; b=rwNqrhgqvRqwmgr+3OL+lQCiO6V/+4P77KWct0hvh/mrbWoa3Wdf4nYqA8Ov0hdqNNWI4dI1piHOq8NfwmP4fLqyhLpYuIeDlbmU/sO743XbP4WZHISd0m8L1qqj+1T98U33lGGbQ4ZG5NcCiBmPh1q5SHjonisRT87lXOZ0zGc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787581477; c=relaxed/simple; bh=TiUk/tasqKoFFi5Y1rsnE8znx96wYepL7S5EiQjZ0To=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZHfoVvvHM8iLwm12tUSNdGRmxEhv9OJL9YtEpa/qfxa74/Dn1qnGsxlLYuf/gckoB9MDMJ3dO8HvCJLddwNot+g0qwiwetQyMtQaQJbMk9V4daygmdScatli5aXJjay1GejeVjUa7TM6wMIAWrrea5t5SUrQSYSt+cUt8PFO3cM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bairaktaris.de; spf=pass smtp.mailfrom=bairaktaris.de; dkim=pass (2048-bit key) header.d=bairaktaris.de header.i=@bairaktaris.de header.b=wcke25Io; arc=none smtp.client-ip=209.85.218.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bairaktaris.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bairaktaris.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bairaktaris.de header.i=@bairaktaris.de header.b="wcke25Io" Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-c20e70a0962so533762066b.2 for ; Mon, 24 Aug 2026 07:24:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bairaktaris.de; s=google; t=1787581473; x=1788186273; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=oY7bftUz/AICMv2zegq1aZcyBsBdoVDaK+uvy3SJacQ=; b=wcke25IoUUwMDzQc4wgO0Qr7jPk2bq5pQeJMIeWvZj4rYt7PXAOr07nbM6OzXXoYgk QSmXJbytKgn7mpJEHgOOuR4Esiih22xUXjsDkeEUtM2Hyxni7nWpwO7wS7yaBBLabudG SWWVjXS/AGeyG/+YMJT6OulpQag9Wn58olZ6xk2HUCC93eaqM9UbU4YxU8pPxeilwER5 m3TYM6cm+kKl1YyPb+f5opzJLCWnW4INF3E8pcMP9x8PZQ3HZmhH4FlRPGgWPyqO1AvM zRPo9fWtAofbZRidmEcZp8sGnQ/B4EV9ANUpsTqi3bjHScHU4s9lKUo5OG1OArh/NKc2 scbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787581473; x=1788186273; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=oY7bftUz/AICMv2zegq1aZcyBsBdoVDaK+uvy3SJacQ=; b=eLNJYPEPMm5X0UZc7hhyaLMlvuraRxrQKATOqdKUQASaqZA0TwlxqY4WyqrGLuzoMX 1823j2dBKoU2Zueoy+kVSi0gg/UcKo7pQGyhDJwhyQPMYNE8bIpmeD08csireTWQTM0m hO1zPv259aiPqihO5u54oPaSocroo/yg1HTrGooV8mLEBL8ND6v2VjKjC+VBi7GIV51p CCJUcP4Tbm/SyLmZuBy+BqUVRrWvSri5EgeY+mJ33G0jtK15/wycJaT5xeXjQDrkWeK2 eq2yrJLJVSEIC0MU7ffZuRifLxiOnjGGKKdnUL/MDIu+bAvOd7t7N84oDoEXRzhAECKF LUfw== X-Forwarded-Encrypted: i=1; AHgh+RpPGM+PAno9dtAoFyEQDnTKwSypWhLZv2EJiG7jt3cXAPAXwdqGCgfnNq7PVTniAgY25s2WoGWA39WZYxc=@vger.kernel.org X-Gm-Message-State: AFuF++lkkTMOgGIZmKeEoiadFj1ui6UDdkkmdIv5VbsuYND1ljVHzOrP 4cF/0303kmGVPDa5tlYNZtMqMoDJp1jKySicduClFwjz8lbhUaUp7t25DoNeva3bgQ== X-Gm-Gg: AR+sD13F2nKrXrrjlfyBXPzrTkIzqs8IVLYIYD+C5IyaE6MO6kMFZoheAykP6UQLpyr FSRZb7OY06BHSKuCPh2EGzKfxO0/ilpuVyJMv4k+3MP9BvIeXoezh7DBC2aZMce6Dmk2r70K9Ao 7RpWLs5yZzk6AhpUpsrnZi5fsUzmopEQtLA9AVGZxTSYaAHFfI3IaiQggo8AoSSn/ol3NUBPdoP ZYvlVBZCYOBnvzI+snn2MUPgIB22G11Hl7h0h/9hWg79diTlaNHxdiho0mbPlIAx9o+cH3pPBy6 yl3gi1EOVDLdtQL0wh8QPB7NIaOTyeNUCuhjwhcrtDKS1l/K2IFAnzOH9uuoSFOUPQ7auFIjnix fHDlDATrvm4owgS0lMyYFdM7DqSsSkumE+5WkPZibGIYHKZD2vE1uwgV/u2JvQGLyR3pNOHRYv0 ZRKVv3bUTRIBJFlJ2+Chsr2SWBFruk5AYPmGgoQAqi5IqbvbhzBVirDENfoO4Rk3M5MroQFjoJO 8mRA25mkMxYW4QNVP10uE+a16YemZGKEskVauG1ARDyxh0E0qhWJl8RvJOT6IfJ9w8j9GDZNkqu 3Zu2lJk6FDUKiAbADhFkRn8gr+fcnKiZYabai87hoXGCTzTF+BI16zj/sxA2nbVP/2pGJAXyl5u AjyroJYgTGwFFJxmGkBa3OMNvOlhT9xFA2eUnzSCh+vIQaXhT4PSR7JZlh6CWME8HSgz99XH0 X-Received: by 2002:a17:906:9f8e:b0:c19:5572:d234 with SMTP id a640c23a62f3a-c246a4ac801mr3371725566b.1.1787581472385; Mon, 24 Aug 2026 07:24:32 -0700 (PDT) Received: from Desktop.fritz.box ([113.30.181.102]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c249672becesm1329890866b.42.2026.08.24.07.24.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2026 07:24:32 -0700 (PDT) From: Julius Bairaktaris To: jjohnson@kernel.org Cc: linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, linux-kernel@vger.kernel.org, toke@toke.dk Subject: [PATCH ath-next v3 6/9] wifi: ath11k: run the TXQ scheduler on tx completion Date: Mon, 24 Aug 2026 16:23:47 +0200 Message-ID: <20260824142350.1757379-7-julius@bairaktaris.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260824142350.1757379-1-julius@bairaktaris.de> References: <20260824142350.1757379-1-julius@bairaktaris.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" A station whose airtime queue limit is reached stops being served by ieee80211_tx_dequeue(), and the airtime it is waiting on is only returned when the hardware completes the frames already charged to it. ath11k starts a scheduling round only where mac80211 calls the wake_tx_queue callback, so once the limit binds, the backlog moves again only when one of those events comes round: most often the next frame from the network stack. Under a saturated download the arrivals keep the round running; a flow that has just filled the intermediate queue, or one whose sender is waiting on the acknowledgements behind that queue, stalls for as long as it takes the next arrival to appear. Start a round for every radio whose completions were reaped, at the point where the airtime has been returned. The airtime queue limit then bounds a queue that is refilled as it drains, rather than one that is refilled when the network stack happens to push. Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.9.0.1-02146-QCAHKSWPL_SILICONZ-1 Assisted-by: Claude:claude-opus-5 Signed-off-by: Julius Bairaktaris --- drivers/net/wireless/ath/ath11k/dp_tx.c | 12 +++++++++++- drivers/net/wireless/ath/ath11k/mac.c | 10 ++++++++++ drivers/net/wireless/ath/ath11k/mac.h | 1 + 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath11k/dp_tx.c b/drivers/net/wireless= /ath/ath11k/dp_tx.c index 52c4a9924a31..e706ba1077eb 100644 --- a/drivers/net/wireless/ath/ath11k/dp_tx.c +++ b/drivers/net/wireless/ath/ath11k/dp_tx.c @@ -694,9 +694,10 @@ void ath11k_dp_tx_completion_handler(struct ath11k_bas= e *ab, int ring_id) struct sk_buff *msdu; struct hal_tx_status ts =3D {}; struct dp_tx_ring *tx_ring =3D &dp->tx_ring[ring_id]; + unsigned long push =3D 0; u32 *desc; u32 msdu_id; - u8 mac_id; + u8 mac_id, i; =20 spin_lock_bh(&status_ring->lock); =20 @@ -756,12 +757,21 @@ void ath11k_dp_tx_completion_handler(struct ath11k_ba= se *ab, int ring_id) spin_unlock(&tx_ring->tx_idr_lock); =20 ar =3D ab->pdevs[mac_id].ar; + __set_bit(mac_id, &push); =20 if (atomic_dec_and_test(&ar->dp.num_tx_pending)) wake_up(&ar->dp.tx_empty_waitq); =20 ath11k_dp_tx_complete_msdu(ar, msdu, &ts); } + + /* A completion returns the airtime the frame was charged, which is + * what an airtime-limited station is waiting on. The arrivals that + * would otherwise start a round are themselves queued behind that + * limit. + */ + for_each_set_bit(i, &push, ab->num_radios) + ath11k_mac_tx_push_pending(ab->pdevs[i].ar); } =20 int ath11k_dp_tx_send_reo_cmd(struct ath11k_base *ab, struct dp_rx_tid *rx= _tid, diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/a= th/ath11k/mac.c index 342b38308468..150b3a1a9c19 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -6583,6 +6583,16 @@ static void ath11k_mac_op_wake_tx_queue(struct ieee8= 0211_hw *hw, ath11k_mac_schedule_txq(hw->priv, txq->ac); } =20 +void ath11k_mac_tx_push_pending(struct ath11k *ar) +{ + u8 ac; + + rcu_read_lock(); + for (ac =3D 0; ac < IEEE80211_NUM_ACS; ac++) + ath11k_mac_schedule_txq(ar, ac); + rcu_read_unlock(); +} + void ath11k_mac_drain_tx(struct ath11k *ar) { /* make sure rcu-protected mac80211 tx path itself is drained */ diff --git a/drivers/net/wireless/ath/ath11k/mac.h b/drivers/net/wireless/a= th/ath11k/mac.h index 59f83c7175fd..4012155dddb6 100644 --- a/drivers/net/wireless/ath/ath11k/mac.h +++ b/drivers/net/wireless/ath/ath11k/mac.h @@ -161,6 +161,7 @@ struct ath11k *ath11k_mac_get_ar_by_vdev_id(struct ath1= 1k_base *ab, u32 vdev_id) struct ath11k *ath11k_mac_get_ar_by_pdev_id(struct ath11k_base *ab, u32 pd= ev_id); =20 void ath11k_mac_drain_tx(struct ath11k *ar); +void ath11k_mac_tx_push_pending(struct ath11k *ar); void ath11k_mac_peer_cleanup_all(struct ath11k *ar); int ath11k_mac_tx_mgmt_pending_free(int buf_id, void *skb, void *ctx); u8 ath11k_mac_bw_to_mac80211_bw(u8 bw); --=20 2.53.0 From nobody Mon Sep 28 08:04:53 2026 Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 02AFD43C047 for ; Mon, 24 Aug 2026 14:24:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787581477; cv=none; b=VAS0bJnLxcrquTMZbGzGAUtOTXKc5Cslz2LLRL/m6x4594WJf0vBMU8gMuyuvNfeR5PLaovF+bNz7Egxs+E5itSSpJwFJ3PbwPyieN1p5pqdWJ9MjoWLEdiXFqM7OIEHb7FIqXksO8JxJpGwZilX5OJT6/cQKXUS5Lq2LE3yK/g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787581477; c=relaxed/simple; bh=ogyBKpcQ5BF8V++IYgH0md1vVjjUWy2iqk+hxadukC0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Gf8TVO5B9gy9H1jKt7rbJK6vSghkBEEvIdZ7wMEJ45IxrmGdJJNqCL/CColL/rg4dfYkvEgBjdY789yKYT2WII+XuwN2xZCWhUiLajDt2OyCvo2G3xEvUYqTwHBpBu5jNTJMVXTtU+UicrrCg6SQ3F8tndEQ2lllz67VVaGwyJ8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bairaktaris.de; spf=pass smtp.mailfrom=bairaktaris.de; dkim=pass (2048-bit key) header.d=bairaktaris.de header.i=@bairaktaris.de header.b=bNujwIck; arc=none smtp.client-ip=209.85.218.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bairaktaris.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bairaktaris.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bairaktaris.de header.i=@bairaktaris.de header.b="bNujwIck" Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-c15e592da74so492944666b.1 for ; Mon, 24 Aug 2026 07:24:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bairaktaris.de; s=google; t=1787581473; x=1788186273; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Z+s09lJoW19HOfjqPgOsY+MAuN3xrwX1WGWVvclfdOM=; b=bNujwIckdwMYCDZML22LA3Wk4t4eyvR1u6sZyP1u23zmc1k4dQn230UWeTDRzgydLZ ULI6GnPx+n8N75VnkHPwAIWP/Sal8osTI4gnAPx0HIidR5nAbKwIE1giYuipaXleTCl3 eDKn2/+y8dfzot1EieCyKjw4HLA3k3RLO3wsDVgAlXxi0g6IR71gwF4xEdth0LOVZk3S UnrTcB9hOE0/PGhyX/QJQqKC+S9CMPEroS0wLQWa/5nA7LYjHPrqqKfxXbI9WIFtMGj+ rn8NsdEWxhzgWrJZZb9qwYcYVGZ/SBCqtff6kOGhXi9h9iIrUNgfQxB+TmsOpgwNYw4V CtXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787581473; x=1788186273; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=Z+s09lJoW19HOfjqPgOsY+MAuN3xrwX1WGWVvclfdOM=; b=kgoFZiSqxGhGRyss3RTJVbpfLmtZxKlOAwU3Wa/3hKFUaHbD8JuHd5PmPCoC/YmLhP DjQa/OdtiL+lrQ+X7nJyB+2CAYVRhG705viqSZY/8HqVpch4dwMZPSKbawujKauOnw5j bhjTFvlHkT48wjoXpc/1ZkDneMchjjEdjowtRBUJMzzsOcdOFVYN4tOCmtKSyTlG3Szg kRmsFoNVRaj2LPqe15H4YnElbbS8eT0KsrWMOtGw3141sbsvGeMvnPleWsF6geh0fN5X UthVcIc/j07gJRu/XIl4KkB/p6GGfXsm61xGAIJB8G4+AKp/pacW8zmL6O6eu8YnlZNN Ph0A== X-Forwarded-Encrypted: i=1; AHgh+RqkKWEJ9aVrAbaPC39GMRit/+FMc8pjDbaoIcGKVCcACdpErzauQHI8l7n2xiwMwdKMqcsvCh+Ao57q77g=@vger.kernel.org X-Gm-Message-State: AFuF++nCHJGmpqdb6UQHLzT6kFkxrFG2/X9hDqXOcinoYbnprDQs2n3o d8cGGP9WzqsDAx6LV+/+VT5qPoqSHCzGg36Jq03z3zJGiSEvtosSaaEjGqWNr+JXUw== X-Gm-Gg: AR+sD13d7dVG4VHUvIBFKOFCltGMp8W+p6V3lYuljGUB56yaZo8PIw98T1sijeYZO/J Gpda8rF4fVB3WX7krHvYHBQZRJr/6OKC80P5HTJ9MZm8vleRH2DKkreUJ9Qj4tur381CkM2LffC nkLDDeiTbDBeEyfuu1duBGmhm45CpV2AjgWH/6stQP7JfgBujVc479WMO+En8eVFjJ4HoI4JpLS bs3u5K4xZYM+9fWH9KBMgQtje0tQktvk1Llt7LI+umKK7R2t+p0JjkZRKwxe+aZpLsOee6MBy9R Tkz8Kd8o2gTCxAfyOZd+5CoYBtkIaMVaB9+fyxVGbw7sRAVqbXovkXVqX3AxzZ2gNrfoqf7reOh bt86iHh6jlu+X19QmIirDIV6t4uf2FcHNrwTW6p05z/6prYoqlk66LOIDwMQEgkNMk4Qjsl4th2 d6US90eF4zjR1HQTvj2TC609Y7n2fV76SUAOlRVTEfhLoC6IzcGCUpLRWIps5kNYkHtTJuLQUQa GudPgNgU57c7k+t2uHb4DKQtoFvtf4joWdsCXk5hprrDHeFHpjLs2q9oHaJtRTCZL8bx/4R4yD+ lX9exgiqNoIbGSyKD18jsJLscXUkq45+dF4gXC0+8FuqT5/2QKXmoJDPiNj+PXTIs6cor4aq5wD 6Xr5OpCwN5xxGgG1UsL8tCT60VWwWjRGpGVis+faqYa2zmjFJLSwMCCua/WjWPenrhEBZP2UU X-Received: by 2002:a17:907:97c4:b0:c20:af9d:454a with SMTP id a640c23a62f3a-c2492621bf8mr2119993566b.16.1787581473076; Mon, 24 Aug 2026 07:24:33 -0700 (PDT) Received: from Desktop.fritz.box ([113.30.181.102]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c249672becesm1329890866b.42.2026.08.24.07.24.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2026 07:24:32 -0700 (PDT) From: Julius Bairaktaris To: jjohnson@kernel.org Cc: linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, linux-kernel@vger.kernel.org, toke@toke.dk Subject: [PATCH ath-next v3 7/9] wifi: ath11k: charge received airtime to the station deficit Date: Mon, 24 Aug 2026 16:23:48 +0200 Message-ID: <20260824142350.1757379-8-julius@bairaktaris.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260824142350.1757379-1-julius@bairaktaris.de> References: <20260824142350.1757379-1-julius@bairaktaris.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" mac80211's airtime scheduler is configured to account both directions: local->airtime_flags is AIRTIME_USE_TX | AIRTIME_USE_RX, and ieee80211_sta_register_airtime() adds the received airtime to the same deficit the transmit side subtracts from. ath11k passes zero for it, so an access point serving a station that mostly uploads charges that station nothing for the medium it occupies, and the deficit that decides whose queue is served next describes half the traffic. Register the duration the hardware reports for each received PPDU. It arrives in the RXPCU PPDU end TLV on the monitor status ring, which is subscribed for every radio, and ath11k already accumulates it as the station's rx_duration. Charging it once per PPDU matches what the transmit side registers, whereas an estimate rebuilt per MSDU counts the preamble and the interframe space once for every subframe of an aggregate: measured against one HE station, the per-MSDU estimate from ieee80211_calc_rx_airtime() reports 16.9 s of receive airtime where the hardware measured 6.8 s. A PPDU that reports no TID is charged to BE, matching what the transmit side does with a frame carrying no QoS control field; the value cannot be masked into range because ppdu_info->tid is ffs() of the TID bitmap less one, so a PPDU reporting none leaves 65535 and masking would select VO. A PPDU from a peer with no station entry is not charged to anyone. Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.9.0.1-02146-QCAHKSWPL_SILICONZ-1 Assisted-by: Claude:claude-opus-5 Signed-off-by: Julius Bairaktaris --- drivers/net/wireless/ath/ath11k/dp_rx.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless= /ath/ath11k/dp_rx.c index 28aaf39cf342..7ef58152719d 100644 --- a/drivers/net/wireless/ath/ath11k/dp_rx.c +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c @@ -5341,6 +5341,26 @@ int ath11k_dp_rx_process_mon_status(struct ath11k_ba= se *ab, int mac_id, arsta =3D ath11k_sta_to_arsta(peer->sta); ath11k_dp_rx_update_peer_stats(arsta, ppdu_info); =20 + /* The airtime a station spends transmitting is airtime it takes + * from the others, so the fairness deficit is charged for it as + * well. This is the duration the hardware measured for the + * whole PPDU, which is what the transmit side registers too. + * + * ppdu_info->tid is ffs() of the TID bitmap less one, so a PPDU + * that reports no TID leaves it at 65535; charge that airtime to + * the same access category the transmit side gives a frame with + * no QoS TID. + */ + if (ppdu_info->rx_duration) { + u8 tid =3D 0; + + if (ppdu_info->tid < IEEE80211_NUM_TIDS) + tid =3D ppdu_info->tid; + + ieee80211_sta_register_airtime(peer->sta, tid, 0, + ppdu_info->rx_duration); + } + if (ath11k_debugfs_is_pktlog_peer_valid(ar, peer->addr)) trace_ath11k_htt_rxdesc(ar, skb->data, log_type, rx_buf_sz); =20 --=20 2.53.0 From nobody Mon Sep 28 08:04:53 2026 Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9DC6E439F9C for ; Mon, 24 Aug 2026 14:24:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787581478; cv=none; b=VLa0t63Zua9oJfL3h18dfTrL/l2iL0lPhiq32RNGXlN8KmHol2/5YLm37IKYZiUsOoCPhcA/au1m5uS3SAWtMb5zV6vseyuUUpsfys/HTDGETr9FydS9URKk4N2yDgYDio3hZVAEJL/dxARHgnSa/XQEMxfdR4YgvTHL7eaSl0Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787581478; c=relaxed/simple; bh=DSexd66nsNepceLBTnaL8EHu7duCBO+eC5BWRUUqKig=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=isltM8I5Qx37vzqOnfgaX+6XfC59AnF7UDHftb+AUCG2aWQU4KuI4cMRuNomGiZQ3x9VZdTqT4K6RV/eMnQanQabsT2ld2HARTEMEi1p/PzijTH9h6jiAs/o2asHGf6LLplgOL4tNTlo4I8RBSkj+x0DGR0x9nSR63k4rer/XRs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bairaktaris.de; spf=pass smtp.mailfrom=bairaktaris.de; dkim=pass (2048-bit key) header.d=bairaktaris.de header.i=@bairaktaris.de header.b=BU5Efo5l; arc=none smtp.client-ip=209.85.218.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bairaktaris.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bairaktaris.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bairaktaris.de header.i=@bairaktaris.de header.b="BU5Efo5l" Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-c15c42a45adso727923366b.0 for ; Mon, 24 Aug 2026 07:24:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bairaktaris.de; s=google; t=1787581475; x=1788186275; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=7x2IYwzlbtio5Xh8rRB/sJgLP9WAbcTtyfFVFxSqfyQ=; b=BU5Efo5lrc5BGigbcSPhKowHGLAttzUYwlKP/xCmMeLY7dB4hLv+gI4eqMxsUItN7u QYjEkmTUOVnexzlBuJvhwFXHG6wjmV9rFaj2HSOZPAY6Kq4ah+nYo3t31aFzBGO0ipy+ SuCemyAUVnx9zT81Vl+99HI/p7xvlkh2MkH8Lrgoo0hmTNUj6XvWI5ven0pP2t+GyWML ZRXhHUH1WQHtElhyIBD4BHGtWtHfXXZg7PxHR4wQCOtsf0NglAkcm5AtZof8G461HAEQ E0Qu5poGVy3LlG412Q566s4GqXVp/RtJxDL0KKhwYBUwFJN3IDTIE1MpdNXfCpgP0l4+ Wh4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787581475; x=1788186275; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=7x2IYwzlbtio5Xh8rRB/sJgLP9WAbcTtyfFVFxSqfyQ=; b=k6WRpDW3MtIYkK2BOPVgR94UtH0v31A1cUC+XV8kyrOC/53IPuH+ut3OAA2l3FK7tX U5lJoDPyY/uhBJyK3DJF4LciJYhAIYCKWIhUtjPbo1GZdiHHufl1LBNBITXYVGPcbyFP Mjhc+kgOnEJp3sEGGXd8HmkuMj6olbfEPg0bi2uuHYVYknejNoCvdLtsT6ApDBoW/aSS OYJ2KEkU6tpKR+Uulkkd33WPT4zPDmbU4oSu7E15le0BDBY4+YUlTtz9HxoKUTy7zfPv GyYZLAFy1oo88CthCHGKTbH9ZHVPp0vfdoQ44MlgO2BYgOqTI6vir8K20TD6qHr2zYgz 1AFw== X-Forwarded-Encrypted: i=1; AHgh+RpKXmaKXzqGxd4z1bKzKhZFdMJy11X3sjUJiN8Cm4U0TBdSYgV19W6G5v4rnSNQzH0TukrKiWK0XKKKhkk=@vger.kernel.org X-Gm-Message-State: AFuF++me4NlJo0YCZOUaRIYzYCT/gD3167Ab+hnxRHG69OOQ1ZUkBZ+2 cMJX0WtbBKVtjyFL2F0aqP0Y/4TkQWFVc6HME2wEvYrA8skapD2wV8kTSkcG9ws9cg== X-Gm-Gg: AR+sD11kIQMYxQsbzq+8YlSXYgv1++jGf56jGhtFt19eLnw8W4iD//W+urMoR3xMI/7 Pei2O2wI+BcW7e0qmC5zoqi6pm46n8nlOE9FxlTaoHwr4vp81MJyBFS6JOf35VBi74cGABwdKiL AK8XFw4dYDShBFfSeQIyRwibOAnLvG2Cgnd0kUBI/SNQVhmVy7nrA59Bp0+nem35T80Qssl4Pgg XEjjdcM1CebcL+wrg69jWxTcmG6XugTecszmirjdnBL+vjb1KVx1/B6Ff6i0zQN6+FhDSF0RmSb 4TnKjMPRLZMYxiRDHde2i+y+Lb2fGyNdOO2BUu6TEDKXxtvY2v1pYkchAuPPTi/gbOAm3GITHU7 7QTnXnBUxhxXjY9Rfh+jiiKJXAlRmQNIHfBGutJhqhIb55OiXdGUS0WaTOFzL24686kiCfYsWw2 SPhaV19U6I3dBSb7aoAQmh1U4FYnAdaRrbHyLGWgQ0UVc2CHFulfk6DikMVY9bdiG39YmHTA9m+ FD4EKEcUwK5XZqNy7Woe3WGvhz2A28JIK62KlYOsPCTECc1d7vU2pUSvQI24z+EZ8UTT6bCkqyA fAZUlZhCTHkV/03AuL8LbRF9MmNcA2ELDkDZKVtD0PpZD+BwZGYLJzUYZ6RsG/08H2RVrpLYmec 61m4f1YOmW62S3qP/6CYSjePcRhE+M4fpO8d64w2qO7OX11KJwxemu0+Jv9T4aowG3EYA/8sTFx 7KLkojvc4= X-Received: by 2002:a17:907:724d:b0:c21:393e:6d10 with SMTP id a640c23a62f3a-c246d5eac42mr2556330466b.4.1787581473811; Mon, 24 Aug 2026 07:24:33 -0700 (PDT) Received: from Desktop.fritz.box ([113.30.181.102]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c249672becesm1329890866b.42.2026.08.24.07.24.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2026 07:24:33 -0700 (PDT) From: Julius Bairaktaris To: jjohnson@kernel.org Cc: linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, linux-kernel@vger.kernel.org, toke@toke.dk Subject: [PATCH ath-next v3 8/9] wifi: ath11k: stop a scheduling round when the hardware refuses a frame Date: Mon, 24 Aug 2026 16:23:49 +0200 Message-ID: <20260824142350.1757379-9-julius@bairaktaris.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260824142350.1757379-1-julius@bairaktaris.de> References: <20260824142350.1757379-1-julius@bairaktaris.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" ath11k_dp_tx() returns -ENOSPC when the MSDU idr is exhausted and -ENOMEM when no TCL descriptor is free on any ring or a DMA mapping fails, and the caller answers both by freeing the frame. Inside a scheduling round that is a loop: the next iteration pulls the next frame out of the same flow queue and drops that one too, so a transient shortage costs the head of an FQ-CoDel queue rather than the tail of a hardware one. Return the error from the transmit path and end the round on it. The round-robin over the remaining stations stops as well, since a shortage that reaches this point is not specific to the station being served. ath11k_dp_tx() also rejects a frame the hardware can never accept, with -EINVAL or -EOPNOTSUPP, and every frame with -ESHUTDOWN while a firmware crash is being flushed; those describe the frame or the device and not the ring, so the round continues past them. ath10k and mt76 end a round the same way when the hardware has no room. Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.9.0.1-02146-QCAHKSWPL_SILICONZ-1 Assisted-by: Claude:claude-opus-5 Signed-off-by: Julius Bairaktaris --- drivers/net/wireless/ath/ath11k/mac.c | 41 ++++++++++++++++++++------- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/a= th/ath11k/mac.c index 150b3a1a9c19..2a70a9c58235 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -6499,9 +6499,9 @@ static int ath11k_mac_mgmt_tx(struct ath11k *ar, stru= ct sk_buff *skb, return 0; } =20 -static void ath11k_mac_op_tx(struct ieee80211_hw *hw, - struct ieee80211_tx_control *control, - struct sk_buff *skb) +static int ath11k_mac_tx(struct ieee80211_hw *hw, + struct ieee80211_tx_control *control, + struct sk_buff *skb) { struct ath11k_skb_cb *skb_cb =3D ATH11K_SKB_CB(skb); struct ath11k *ar =3D hw->priv; @@ -6533,7 +6533,7 @@ static void ath11k_mac_op_tx(struct ieee80211_hw *hw, ret); ieee80211_free_txskb(ar->hw, skb); } - return; + return ret; } =20 if (control->sta) @@ -6544,20 +6544,36 @@ static void ath11k_mac_op_tx(struct ieee80211_hw *h= w, ath11k_warn(ar->ab, "failed to transmit frame %d\n", ret); ieee80211_free_txskb(ar->hw, skb); } + + return ret; +} + +static void ath11k_mac_op_tx(struct ieee80211_hw *hw, + struct ieee80211_tx_control *control, + struct sk_buff *skb) +{ + ath11k_mac_tx(hw, control, skb); } =20 -static void ath11k_mac_tx_push_txq(struct ath11k *ar, struct ieee80211_txq= *txq) +static int ath11k_mac_tx_push_txq(struct ath11k *ar, struct ieee80211_txq = *txq) { struct ieee80211_tx_control control =3D { .sta =3D txq->sta }; struct sk_buff *skb; + int ret; =20 /* ieee80211_tx_dequeue() applies the airtime queue limit itself, so a - * selection ends where that limit binds, where the hardware queue is - * stopped, or when the queue empties, as the generic handler does - * today. + * selection ends where the airtime queue limit binds, where the + * hardware queue is stopped, or when the queue empties, as the generic + * handler does today, and additionally when the hardware refuses a + * frame. */ - while ((skb =3D ieee80211_tx_dequeue(ar->hw, txq))) - ath11k_mac_op_tx(ar->hw, &control, skb); + while ((skb =3D ieee80211_tx_dequeue(ar->hw, txq))) { + ret =3D ath11k_mac_tx(ar->hw, &control, skb); + if (unlikely(ret =3D=3D -ENOSPC || ret =3D=3D -ENOMEM)) + return ret; + } + + return 0; } =20 static void ath11k_mac_schedule_txq(struct ath11k *ar, u8 ac) @@ -6569,8 +6585,11 @@ static void ath11k_mac_schedule_txq(struct ath11k *a= r, u8 ac) =20 ieee80211_txq_schedule_start(hw, ac); while ((txq =3D ieee80211_next_txq(hw, ac))) { - ath11k_mac_tx_push_txq(ar, txq); + int ret =3D ath11k_mac_tx_push_txq(ar, txq); + ieee80211_return_txq(hw, txq, false); + if (unlikely(ret)) + break; } ieee80211_txq_schedule_end(hw, ac); =20 --=20 2.53.0 From nobody Mon Sep 28 08:04:53 2026 Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F17C43E06F for ; Mon, 24 Aug 2026 14:24:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787581479; cv=none; b=RSjyzsCid1+mv4zMEywco5ag0akOUDP1GUoYdy/YiBSUleIOzipj5lXNOOPGCx0+YL84kVoIaQUv0whYgAFdZL2pHjeD1DMBVKFSi6YcwJArYMGLSgJ3zYIpxF8ZXZ9spUZDBfon7gZPMFQs7eAbKPJGHSvM/2go5ie/VwupPjE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787581479; c=relaxed/simple; bh=yKBxfIvqmTFV9KFIz24PawDAZW0RtOJmtLbhFdpR+zk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=s1+uj77krWCpXCqQa0OX60KDKu/slFSO473rVq7n0ipPHo8wfwbuccuxf3o9Wnb/8tNlelAsrV5db7N75z+yn6c9v8R5TclluDdhUUeT9ij7MQweIRAx0GEnFkOdgUwjd+H7Q5wFMl0twaNzrQjW55zLmJIpBP7pypIXZm6wT+Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bairaktaris.de; spf=pass smtp.mailfrom=bairaktaris.de; dkim=pass (2048-bit key) header.d=bairaktaris.de header.i=@bairaktaris.de header.b=Ckd6yJw+; arc=none smtp.client-ip=209.85.218.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bairaktaris.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bairaktaris.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bairaktaris.de header.i=@bairaktaris.de header.b="Ckd6yJw+" Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-c15d3cd51b2so533727366b.3 for ; Mon, 24 Aug 2026 07:24:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bairaktaris.de; s=google; t=1787581475; x=1788186275; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=NrM2RZiWM8sldUeyTNqlmxOQd471ZY1V4UxOl51GWtY=; b=Ckd6yJw+xlM5aI2/dV7VkEW0dCzoGb1WNdKyDr6l+5+yGIV5TPK41UwDif3sZALE0x YA24TBJMewV64SBWwuR5VfkcKXTYlAvq9HQF1+1aH6tO0Rm6TcvYZIuw2QaRr/Gd/heY ZYX4FTdsLiqQ2eyUvaMgL2yhiGxdbZ2hD3aW9AZkMnpYdqTXShnLdB+MsBue65LcV0An sSazVWcW+QFaxT+sD7k+HCZzElMNgUvoSz4VEEPhvvf1KxyQI2A8fVbfIMcrK/oO9+lb 9sWGrEV6pU7EBkjZfHqYPSX5kz8gtzKN8tD3lLKFVuKEbSa8UEnmY9iFPUaaidt+J7Bz yOew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787581475; x=1788186275; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=NrM2RZiWM8sldUeyTNqlmxOQd471ZY1V4UxOl51GWtY=; b=FhDOmt+u4vksC7QY8lIeGsaG2aAot/Wf6DvbjbBrYtxYyQC5QYryBZgOaJE+4U+Qgq hcgIF2UpGs4HTschMQ5e1wYSSSbHRXdk82bdQuy89eTWJ+H1wOSA/tgEnPgWQaavChd3 +JXmNDf4jOeffL/I6rxblWoecT7w9hf+MLp2dj00+2JZ0q0nHsdK8GZ7sJ6hZTPOynEW 7F18PK0BycPkP3bB12PyWwu4knVY1hNCEISJtr6ofkHLXrGHeAJy7vkyvgMoJW6sA4P+ dLcDrN/ZxExoEeUZr8R8v5RF0x5VtEqN7F6uuOnMdEpUvMcWBA+D7EYY+4fQUd2v0XuL XknQ== X-Forwarded-Encrypted: i=1; AHgh+Rrkq0g/O+QFQqhpUv/+cWslXXs0KIk2g3hmmssAJ5Ys+YvcvjoR7Un1dX8Wrw/VXoHmq/Lp08IYf3P3pbU=@vger.kernel.org X-Gm-Message-State: AFuF++nmeuf0FZm/sV5sda/dQchLg5tdlw0zA7e2ssznbwkTRWJ4nz4r WHunUwa3MO8Pv2do7V2V9of9DPgp0p2omFw+zApcVKZybc1MTmtTCZQ89Pw21chOOA== X-Gm-Gg: AR+sD10VQ06asEpaa/CQBfUuzJkJQ3769phm9vIGXobAbbSCQEzNsy5SVFqKWe7rHQI iZk0GPytjr+Ee9VLBZXO19KwLPovHIrY/GfWY3ELFB89zKdS1b1D4nmhOsTboGfuB+QSYxDwv9O Egb7YMB1l+3ZjcAMLiu96/MMyahoWL4CPwVXbOo2KPJk0ZZV+1X/181Z+m+XyMUrQNY/+yEm36h NO2UJVl+zFY7dMuEm9hgT4abyAN9DKnKY944faF4HPHQ5imHscliWf9H8dm4TH34zYTgMtiG/QD fhjCNnIKejIkLyX0O3lQKd0MBZOsmpiix/RbdypZ7efziG6IcpYx9WRl6G+rOKnCU7c2GylSC9d k8FjRS5ZTLpcyCakJLbBHIXzYt1AT4iHANsKH1lfr5IFXIX4sFz6vg+2V/3O7YylVSkSKtoF3p+ auVcpPcTSD0FoYLF3JqYViFSHY0VUOckAHWzhPEs2NL9vi3uK9WVzYWCTa/Apt9EmjBch4IAsOg yNL2tKe4d08ICcb3sTQV5SSYlwbFtcNXhdDl8AHuYeHjHpSMzJi0dUVnr6t1bbbG1daNoT+lBR6 6Ur5PYiFmTel6wEeLRB4gxcmn9lQ5e7N94Ffp7JBHg8wK3ZCKtT67+wHnxZcIW7G/V/t/Gpzjex /3iTZW5Y6alMR+F1vdxQF3BneKwLt6qs1BMcMnhF3VWpjS0veXWst9+rK54x9su7QjHqJYFQshD T9JjRV0wJa X-Received: by 2002:a17:907:930a:b0:c24:680b:3944 with SMTP id a640c23a62f3a-c24925e416dmr1935275666b.13.1787581474570; Mon, 24 Aug 2026 07:24:34 -0700 (PDT) Received: from Desktop.fritz.box ([113.30.181.102]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c249672becesm1329890866b.42.2026.08.24.07.24.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2026 07:24:34 -0700 (PDT) From: Julius Bairaktaris To: jjohnson@kernel.org Cc: linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, linux-kernel@vger.kernel.org, toke@toke.dk Subject: [PATCH ath-next v3 9/9] wifi: ath11k: budget the tx completion handler Date: Mon, 24 Aug 2026 16:23:50 +0200 Message-ID: <20260824142350.1757379-10-julius@bairaktaris.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260824142350.1757379-1-julius@bairaktaris.de> References: <20260824142350.1757379-1-julius@bairaktaris.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" ath11k_dp_service_srng() calls ath11k_dp_tx_completion_handler() without a budget and discards its result, while every receive block below it takes the NAPI budget as a bound and reports what it consumed. The handler drains the whole software status FIFO, which holds one entry short of the 32768-entry release ring, and each entry costs a DMA unmap, an idr removal, a peer lookup under the base lock and a call into ieee80211_tx_status_ext(). One poll can therefore run for as long as the hardware has completions to report, with the receive rings behind it waiting, and the scheduling round the handler now ends with adds to that. Bound the drain by the budget it is given and account for it the way the receive blocks do. No new constant is introduced: the bound is the NAPI weight the poll already carries, so a poll that spends it on completions returns and is rescheduled rather than running on. Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.9.0.1-02146-QCAHKSWPL_SILICONZ-1 Assisted-by: Claude:claude-opus-5 Signed-off-by: Julius Bairaktaris --- drivers/net/wireless/ath/ath11k/dp.c | 10 ++++++++-- drivers/net/wireless/ath/ath11k/dp_tx.c | 11 +++++++++-- drivers/net/wireless/ath/ath11k/dp_tx.h | 3 ++- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/dp.c b/drivers/net/wireless/at= h/ath11k/dp.c index f389b97acbdd..676440ee742a 100644 --- a/drivers/net/wireless/ath/ath11k/dp.c +++ b/drivers/net/wireless/ath/ath11k/dp.c @@ -781,8 +781,14 @@ int ath11k_dp_service_srng(struct ath11k_base *ab, =20 for (i =3D 0; i < ab->hw_params.hal_params->num_tx_rings; i++) { if (BIT(ab->hw_params.hal_params->tcl2wbm_rbm_map[i].wbm_ring_num) & - ab->hw_params.ring_mask->tx[grp_id]) - ath11k_dp_tx_completion_handler(ab, i); + ab->hw_params.ring_mask->tx[grp_id]) { + work_done =3D + ath11k_dp_tx_completion_handler(ab, i, budget); + budget -=3D work_done; + tot_work_done +=3D work_done; + if (budget <=3D 0) + goto done; + } } =20 if (ab->hw_params.ring_mask->rx_err[grp_id]) { diff --git a/drivers/net/wireless/ath/ath11k/dp_tx.c b/drivers/net/wireless= /ath/ath11k/dp_tx.c index e706ba1077eb..b309a97d6ad2 100644 --- a/drivers/net/wireless/ath/ath11k/dp_tx.c +++ b/drivers/net/wireless/ath/ath11k/dp_tx.c @@ -685,7 +685,8 @@ static inline void ath11k_dp_tx_status_parse(struct ath= 11k_base *ab, ts->rate_stats =3D 0; } =20 -void ath11k_dp_tx_completion_handler(struct ath11k_base *ab, int ring_id) +int ath11k_dp_tx_completion_handler(struct ath11k_base *ab, int ring_id, + int budget) { struct ath11k *ar; struct ath11k_dp *dp =3D &ab->dp; @@ -695,6 +696,7 @@ void ath11k_dp_tx_completion_handler(struct ath11k_base= *ab, int ring_id) struct hal_tx_status ts =3D {}; struct dp_tx_ring *tx_ring =3D &dp->tx_ring[ring_id]; unsigned long push =3D 0; + int done =3D 0; u32 *desc; u32 msdu_id; u8 mac_id, i; @@ -723,10 +725,13 @@ void ath11k_dp_tx_completion_handler(struct ath11k_ba= se *ab, int ring_id) =20 spin_unlock_bh(&status_ring->lock); =20 - while (ATH11K_TX_COMPL_NEXT(tx_ring->tx_status_tail) !=3D tx_ring->tx_sta= tus_head) { + while (done < budget && + ATH11K_TX_COMPL_NEXT(tx_ring->tx_status_tail) !=3D + tx_ring->tx_status_head) { struct hal_wbm_release_ring *tx_status; u32 desc_id; =20 + done++; tx_ring->tx_status_tail =3D ATH11K_TX_COMPL_NEXT(tx_ring->tx_status_tail); tx_status =3D &tx_ring->tx_status[tx_ring->tx_status_tail]; @@ -772,6 +777,8 @@ void ath11k_dp_tx_completion_handler(struct ath11k_base= *ab, int ring_id) */ for_each_set_bit(i, &push, ab->num_radios) ath11k_mac_tx_push_pending(ab->pdevs[i].ar); + + return done; } =20 int ath11k_dp_tx_send_reo_cmd(struct ath11k_base *ab, struct dp_rx_tid *rx= _tid, diff --git a/drivers/net/wireless/ath/ath11k/dp_tx.h b/drivers/net/wireless= /ath/ath11k/dp_tx.h index 9303b5ba6e01..b5296cda73e3 100644 --- a/drivers/net/wireless/ath/ath11k/dp_tx.h +++ b/drivers/net/wireless/ath/ath11k/dp_tx.h @@ -21,7 +21,8 @@ void ath11k_dp_tx_update_txcompl(struct ath11k *ar, struc= t hal_tx_status *ts); int ath11k_dp_tx_htt_h2t_ver_req_msg(struct ath11k_base *ab); int ath11k_dp_tx(struct ath11k *ar, struct ath11k_vif *arvif, struct ath11k_sta *arsta, struct sk_buff *skb); -void ath11k_dp_tx_completion_handler(struct ath11k_base *ab, int ring_id); +int ath11k_dp_tx_completion_handler(struct ath11k_base *ab, int ring_id, + int budget); int ath11k_dp_tx_send_reo_cmd(struct ath11k_base *ab, struct dp_rx_tid *rx= _tid, enum hal_reo_cmd_type type, struct ath11k_hal_reo_cmd *cmd, --=20 2.53.0