From nobody Tue Nov 24 11:44:06 2026 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.218.49 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795371106; b=qLttNTuBWdQk60HY7qfyEs/pmWyMnJu9H6TLZdLfQPmieuMPb/ew7vPXCNzo5zUdbF8o 4gdDDaCApDajWJAY6hakrLKN0nVd9JmjzJiQCQEha3/Namhukt22yZSqRTCROr3VqPtea wFFtWzNBeLTrdJ5JFGcsgzwMoPlsy9MoaWTWPqo9tBbakr6CyWWP7PCW+CVdv2gcDwiAr 7yFGHUirbf4krMR8BjJ0n65YmWavT7OEbOH8fkarNpIHa+OcDdWRmKyMg08XuPCxcp2x0 Dl19FX4h2YWhdWQlq2N2bn8BOGHmF+9xMw3Zzoh4iN6D5ZwZcodpV9Ql8QEdqXkQZqg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795371106; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=RophBW0lS5Y4OdQtBAA0javqVSRJb0KQxbS9aAGVlSw=; b=uBTwX+pQE6tBsCs9bHNke3dhZGrDFhQ4nYrjxKX4IuQXg0UPhzJRGNLg1wz915QXJUSn xqnjdrTcf/3WVEQ1TciLeQuZDL+ewAGrdE2XY2dXk52/5fbVpLLEZRvYNVNAXQwS+dxLt xTb8UGdVxpqYZlSJ3shPkC5DMhlzv0M2fJlVXNazjw9nNYUmliDGp6FwfrTr6FTyfbe+g M3JCJxba5Pcn7h+J6i9whSJIGTu/mNXQmQuVN31cyBHQdHc7jjHXygNCEo3pbemIDL+e0 sNPLaTQZ5uNlriPajOjX5M1Mk+UTpjvkAQEmSIsMdeHBMqaF+4EjO/v52zuk1Dre2fA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=bairaktaris.de; spf=pass smtp.mailfrom=bairaktaris.de; dkim=pass header.d=bairaktaris.de header.i=@bairaktaris.de header.a=rsa-sha256 header.s=google header.b=dpWb6Z7x; arc=none smtp.remote-ip=209.85.218.49 Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4D3D5606A330 for ; Sun, 22 Nov 2026 18:11:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 4D3D5606A330 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.a=rsa-sha256 header.s=google header.b=dpWb6Z7x Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-c5154989984so254349266b.1 for ; Sun, 22 Nov 2026 10:11:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bairaktaris.de; s=google; t=1795371105; x=1795975905; 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=RophBW0lS5Y4OdQtBAA0javqVSRJb0KQxbS9aAGVlSw=; b=dpWb6Z7x0O3luLpFip3n2Xv7A6xU//4IHw9SylRlNviVUdKJeNJf1L+kyjAnmngVI5 WC9svjqB9AviyNCcMF0Ef1qYsUAqgfM8+7vNFP3AAqWkusAoHVwEWrzYrt+sp0K+PBf9 2NxnyL/50MQ6vssJ+1VDiTVVmJ4Zbe6dWg1O4t4Fh4BFJUuvI8nGGKTOdDvfNHJ0Np/G 8I/ZqILWPQDVlwSSl3kV58ssCrN6QTq7d7+4bDfKhWvLNqnHVM5W8/7+C49QBBZsUppl X6isDfaPUvyyQzvI2D6zKwBslQW96Sj7Q+ZTPHoak8nSwHcaX/A4pekCT0U7HftD2yre o3yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795371105; x=1795975905; 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=RophBW0lS5Y4OdQtBAA0javqVSRJb0KQxbS9aAGVlSw=; b=UFs52f81c3dHS2a9Yc0hbmOIZf8+YG0tPd72o/4AnZnLJ7g6M3isxf8INa1xz2XOR2 ziW9jVQ7CoDD2djj8/yxg0TMWAKLmLO6056BU3U6ioFj2Gq4V+HnUyMWzFyW8cekOZtW vrHZ69btDiums/a5HVVsktdE3GjoGV+Qe3KN+rwaIGK6ey8x8EywKnY6iFJmukFhAbIU uShD6XP38oQ85vmt4PzuO9dji69nMjQ6sRwtDsnFSKkOgpgafO0BzUPL+J4Pl3/It+co uApXihGDp1PVUNDilA0B+cFq1xIjNyuHcBE9uqO/sr6ACJnuRaurdXUAtR4nc1KLvj86 nAKw== X-Forwarded-Encrypted: i=1; AL+hErHdyYhRImwddlM51QYh3qycDHTPfFcp2R6uEgV/WR7Vly3/Srz2k7QGyyCAQ0iLXNJx4an4KgzDMYU83YU=@vger.kernel.org X-Gm-Message-State: APuU4Z918cvieo/5PTzu/j0QpUHI9mUu6dcbleHoB+Sx78sGuFf10NU1 MEW9xOxAEfwtBCgTqP1Aw+Ryy2iQYICnSYixojgClfvg4R3z5Oc/vBE7H3kdOt4PLg== X-Gm-Gg: AZFdTZd+a3SDzS8d02RND/hhWrpIWxmRyIqURcfaOrYRaaglki5nYvgcRmC1/MvMkfE jG49GGyRpT0aijL1wNH5nfNHThJ8x02kaEPD4nD8kUXs7JjdZAWXQrP4zriuSuK1byTSXXvbQcK x7QlzbUbCm/nuC5owGwGkCkOTvAPiUxAUKIMy2SXbeQUgaggV+AxvBF3717wswPg0rEeChJgPBu 4YteQVpZk+bgGfobuK5lE2z+kYk9Xd7WdqrO1MV1EgwgCnl/rdmsJQ+AG8ghzK8rEk6orptQ6tv DXpvU1LCBrLS5bv9ns8DzRz5103ibPdoaOLTriBKwZBQnfWhgAFV5dToUurndg06ZkDoIKO5yK1 VwZuOiSKMdMMUiUqEWACjTs6LKyl9/OtwmrR6S+AE3Fr3TtWhVsf8lS02s8Y6BwsE8l9pWS18Ww lLUSniT/iwXdRiOVs1vQSI6TqXUVPHATAxMkm0xILGKdz6Bv/WV55D0wUwsN5U479GpPyLITsp6 WuSuFCJKx+a6OKw9kDhSN4RoLuZ98Xt0ShxX7RpuEicJMEMEqmHm895tEFBBUgky544MaocK8eV nM4HUzSNhePuNUHhJG92Fozu45Wvakg9t1mqFIem22M5pW1woBMKL0cBsRqwO3+6oy9cUxwAK+c OJPmZxa3j/F+Ou3rgMisOyPOG4Jbi7DpB/dkFlHnFzU366yW6+4zMeH40+I82L4Wdpe3lyQOqkr Ue7LiELZ2GO0dHI3S+VC486UZ23blZWrgu1Is9aTrmSkKmvXGjAOr2wB+pgHKI3xvEtUb6yqdPE aCrIzmCvKFFSH2sl21YT75LktPVf3GNTLf51iSz0V2caezGUyzB6gvBMunpVuSG+uuOQp9Xj3M1 DeZoTHRww3+1QsKep3R7VyaZfzJb0K/x0BKlXSPk8C5uLE5oH8PHrSNXiszrYEApHYJdq9wI X-Received: by 2002:a17:906:3388:b0:c3e:e726:9548 with SMTP id a640c23a62f3a-c513a5ec801mr604533666b.14.1795371104720; Sun, 22 Nov 2026 10:11:44 -0800 (PST) Received: from Desktop.tail070c67.ts.net (p200300f24713a700f1770d5b08d979ed.dip0.t-ipconnect.de. [2003:f2:4713:a700:f177:d5b:8d9:79ed]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c513ae88143sm325931266b.32.2026.11.22.10.11.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Nov 2026 10:11:44 -0800 (PST) From: Julius Bairaktaris To: Jeff Johnson Cc: linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, linux-kernel@vger.kernel.org, tamizh.raja@oss.qualcomm.com, jtornosm@redhat.com, baochen.qiang@oss.qualcomm.com, rameshkumar.sundaram@oss.qualcomm.com, vasanthakumar.thiagarajan@oss.qualcomm.com, sriram.ramachandran@oss.qualcomm.com, yaojiale02@163.com, quic_pradeepc@quicinc.com, kvalo@kernel.org, sven@narfation.org, john@phrozen.org, toke@toke.dk, Christopher Griffin , Julia Lawall Subject: [PATCH ath-next v6 1/9] wifi: ath11k: free tx skbs through ieee80211_free_txskb() Date: Sun, 22 Nov 2026 19:11:37 +0100 Message-ID: <20261122181145.1015729-2-julius@bairaktaris.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261122181145.1015729-1-julius@bairaktaris.de> References: <20261122181145.1015729-1-julius@bairaktaris.de> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" ath11k_dp_tx_free_txbuf(), reached for the HTT REINJ and INSPECT statuses, frees the frame with dev_kfree_skb_any(), unlike every other tx completion path in dp_tx.c, and so does ath11k_dp_free() for the frames in flight when firmware recovery tears the rings down. This leaks the tx status clone and idr entry mac80211 keeps for a frame whose socket asked for status, as commit 29d15589f084 ("wifi: ath11k: Cleanup mac80211 references on failure during tx_complete") fixed on three sibling paths. With NL80211_EXT_FEATURE_AQL, set by the next patch, it also keeps the frame's airtime charge, which ieee80211_restart_hw() does not reset, and an access category at its limit is never scheduled again. Free the REINJ and INSPECT frame with ieee80211_free_txskb(), and return the frames in flight to mac80211 in ath11k_core_reconfigure_on_crash() before ath11k_dp_free(), which also runs at teardown after the radios are freed. Neither HTT status occurred on the hardware below, and the recovery path was not exercised; both changes are by inspection. Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.9.0.1-02146-QCAHKSWPL_SILICONZ-1 Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices") Signed-off-by: Julius Bairaktaris --- drivers/net/wireless/ath/ath11k/core.c | 1 + drivers/net/wireless/ath/ath11k/dp_tx.c | 39 ++++++++++++++++++++++++- drivers/net/wireless/ath/ath11k/dp_tx.h | 1 + 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/= ath/ath11k/core.c index 766ae27306f43..34cfdedea6adb 100644 --- a/drivers/net/wireless/ath/ath11k/core.c +++ b/drivers/net/wireless/ath/ath11k/core.c @@ -2341,6 +2341,7 @@ static int ath11k_core_reconfigure_on_crash(struct at= h11k_base *ab) ath11k_dp_pdev_reo_cleanup(ab); mutex_unlock(&ab->core_lock); =20 + ath11k_dp_tx_free_pending(ab); ath11k_dp_free(ab); ath11k_hal_srng_clear(ab); =20 diff --git a/drivers/net/wireless/ath/ath11k/dp_tx.c b/drivers/net/wireless= /ath/ath11k/dp_tx.c index 083aca8ff355b..0e3b4e836001f 100644 --- a/drivers/net/wireless/ath/ath11k/dp_tx.c +++ b/drivers/net/wireless/ath/ath11k/dp_tx.c @@ -305,13 +305,50 @@ static void ath11k_dp_tx_free_txbuf(struct ath11k_bas= e *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 +/** + * ath11k_dp_tx_free_pending() - return the frames a crashed firmware holds + * @ab: device being recovered + * + * The radios outlive the firmware restart, and mac80211 keeps the tx stat= us + * and the airtime charge of each frame until the driver returns it. + */ +void ath11k_dp_tx_free_pending(struct ath11k_base *ab) +{ + struct ath11k_skb_cb *skb_cb; + struct sk_buff_head pending; + struct dp_tx_ring *tx_ring; + struct sk_buff *msdu; + int i, msdu_id; + + __skb_queue_head_init(&pending); + + for (i =3D 0; i < ab->hw_params.hal_params->num_tx_rings; i++) { + tx_ring =3D &ab->dp.tx_ring[i]; + + spin_lock_bh(&tx_ring->tx_idr_lock); + idr_for_each_entry(&tx_ring->txbuf_idr, msdu, msdu_id) { + idr_remove(&tx_ring->txbuf_idr, msdu_id); + __skb_queue_tail(&pending, msdu); + } + spin_unlock_bh(&tx_ring->tx_idr_lock); + } + + while ((msdu =3D __skb_dequeue(&pending))) { + skb_cb =3D ATH11K_SKB_CB(msdu); + dma_unmap_single(ab->dev, skb_cb->paddr, msdu->len, + DMA_TO_DEVICE); + ieee80211_free_txskb(skb_cb->ar->hw, msdu); + } +} + static void ath11k_dp_tx_htt_tx_complete_buf(struct ath11k_base *ab, struct dp_tx_ring *tx_ring, diff --git a/drivers/net/wireless/ath/ath11k/dp_tx.h b/drivers/net/wireless= /ath/ath11k/dp_tx.h index 9303b5ba6e012..9a26de411e83a 100644 --- a/drivers/net/wireless/ath/ath11k/dp_tx.h +++ b/drivers/net/wireless/ath/ath11k/dp_tx.h @@ -22,6 +22,7 @@ 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); +void ath11k_dp_tx_free_pending(struct ath11k_base *ab); 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 From nobody Tue Nov 24 11:44:06 2026 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.218.48 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795371107; b=y9coFXXsBujPboY8GPmqR4kK359isufTedB5aYBzzfqjWow7GPIRwGNie73XtaCeefoF e8iOUR8PDqw2qkVKGJKiQSjO+E0AVak/3TCM+uk/Kk8YCsQq0gkejv8gQ8jYRL/YW1uOM 7HEDDLvUzrHTOs3jfkyCxQWG7IvvSosdqxlgqxBoadKhZwUhlFlGbFrRPU3TOKaNyJAFl iMfPksQrp3UOObIIFHQs8ByfbtP3RqJKm6jo0CjcE/9g7YWjPPAMLLjVdWIDu9Jo8rYPz vttaBhZgoThKvnskaLYtX8pIb0E95g/dT34IM8bX5LBi5OuAzfGTNghztUBKhI4pyeQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795371107; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=VbRn6lUIefHO9idsi1h3mMXbFeQtqB3zWbpoKodoBns=; b=WV1CkkGGIocK+tnq/4v6YeNPTlTnQDj3TTilHEAueTQiffAVmlWMnfdR3sBbP1E/nu8c MNpR5GToZHukhuwVJENBf8NxplDBHP9axPo75wZH9l1rjhVsWOnp4qRUotBAFaLBuuOLM pRiPrZDpTb75m3cMWIYRUNxZCkjCyhbapWk4d7i75FR7RAUKBbW1FPJaXDm12Lqv0nzm/ 7hlIyAUojgywJDrrWUbrse1VrWL3Zl6zIuOLDCp5+3xlD9kdhVgsdk52Tgfws4Wj158ZY Vf9IE3x037Cr1Rf/J8r570isvKvJLf4oNZIKl4w3bMAaLj2dFoeip9CdAGRZ7NyJd0Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=bairaktaris.de; spf=pass smtp.mailfrom=bairaktaris.de; dkim=pass header.d=bairaktaris.de header.i=@bairaktaris.de header.a=rsa-sha256 header.s=google header.b=m7bp2Vrf; arc=none smtp.remote-ip=209.85.218.48 Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1FD8B606A682 for ; Sun, 22 Nov 2026 18:11:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 1FD8B606A682 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.a=rsa-sha256 header.s=google header.b=m7bp2Vrf Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-c4203bbb1e9so416619166b.3 for ; Sun, 22 Nov 2026 10:11:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bairaktaris.de; s=google; t=1795371105; x=1795975905; 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=VbRn6lUIefHO9idsi1h3mMXbFeQtqB3zWbpoKodoBns=; b=m7bp2Vrfqa0aHM9Yw8BJMpNb02/+acqC51Cs8Atw0TtC6Xg0n282++SueOTPMyFiqJ f5mr0KoO8f95LWQUZiJFcHz+h0DB12ejFSEkNMvbMwoQ2Vqe85WwSfgGaWAEYoLnrdln KP/stVxIx4kHMKhgiKDU3jRZXF+AiyOknd4mWaJjIz2S56hj4vvHvBLmvO2+i1YAiKqc BgH4Xl1wpR3V2N9vBvr/ZtxIZ3JYIc8SdE1N5XQuvi0APZNk1Ch2g2M2cliZswfIvkqn 8TZhLYvDF1JH8BUP0ZGCzPS1KBa41gZ5WS+rJcyx8KieRMG8rZf07tEA97dndJAq2cTV AZZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795371105; x=1795975905; 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=VbRn6lUIefHO9idsi1h3mMXbFeQtqB3zWbpoKodoBns=; b=B0FF7hB0kPMFVoydsNXDE3WuuZB2QNsPWA5KghjeCdR+uKMlL6XvACgHDfDVis7EUn WxWY8TxEbsTsxEbuXqo+s1SaLj2fh6gD/6mJx/d7Zk9lvzLGkh/psUqEaIVgYZvIwUg6 ttkZIZCYGrSMAoKSXsfaQVDDAOMJan2OYI27pNSOteuVBcU63Nl+bafT1EsUDF+kE2sc qF9lzM5l4dC9/VMDntfZ1Oqtx8MfCzthjPFwXrl7LISASMZX0FE4RYFXvIsLO5qxsNZn NapDOZi9DtYoYMEvhapQ0NNdKAb+r7L6B5sxTu/3K+DL0X4cbsS4EOdYeJBvxWszAKD1 bNCg== X-Forwarded-Encrypted: i=1; AL+hErF/OHpNgbpddoAXfDc4pcxnmjdk6yZPa4P2sriKogFKBdb4evBVYDIN9hEudtc/eWzXiOo00jGxlFewbv8=@vger.kernel.org X-Gm-Message-State: APuU4Z9Gx5LwcqTYbvM2OYC2gh2p3mSajw5J0vKovZyKYwHlEd8HeRPu ujAmxwQxIhzkZexf2pL0+tOJ5r2JcF5GDxZau0QkTJTexsv7jncNQYJsbTTGMuqlqQ== X-Gm-Gg: AZFdTZcOAw91H9ia69JaPZ7B3HS3xmLjpZsbTyPlQc6PU+tosOy+t0WYE5/Ye3aVhJW dGhBx2xNjS0OS4o7pWIog7hjUrhz8X9+mDpQ4k65rJaI9AYwkhzzPP3Kz9ZUTgrrWEGz/yewjXb pnUVH7qGhsixwtRRoH0j40Xrpv2+UNsqp+/2DRhAk1yXXTR9GiExalnHzRv8t6GFwJKaTHd6D0U TtHWJt4pts585eFyWrqZBIP0wlJU2b/x45/zlBGUiD0RD0JrS0oYB+ewJ0QMC9ft6J4LbewkyrO r9ce9Pg524Nqf3XSy3PwBW+dHALqYuzVa+CzL6qRkS+okJrJqm52rhR3PBDR2rhP0KkhilAZq9b D8br6AcWQNSuvOfMEAjJxhRc8z+wDx3FWxDqdZcRTdj9OLydfgpQKneRsdFIHAKK9lZ0ts200Q9 /OFcjcDp9xvKq1nYRejzALtJR6afrhG9Y+QoNMTeZt0/ZL9HtS8xluFXeXo18DtmMrLZfstnPQi /DxZFsS8QXZnYMoGBQfGaiC+KXQRBoLqApSijwOYC1fv4fx4GUL3kcbCHlPpZyceZSbvll/u/Nn JKhRMnO65mluQ2VYmPvUyOtvo2ciswaXkdvvehNu09AAQxD0NXlD3UO7jL0C1V6fnGw4cJbWtPV tBcftXpVJBTx2jVvC7djvm5qOXqIggAga3Mrzgndc041jbd6XSrcTQJqCgh43CXcheNNBa9Zu/B yXogY1hV0U8dNf1tyl9rwUlcfb8ihehJmXl7VA61DSg+BCOUZ8j3vi04WBRX7fpw2TX506C7Bvh REKwLoeY2mgzXaEl5sste7CdWuwaeouUkjk9+s7HGZact2WXP8YC+uQPkTJk6PaXreSsypsXqMW /Ppu9YdhthIiKmXUUsLt0qU2dVi2Xazyd0K2OZDQiwV8N08pAkPlUYfvOH2F+scHwKBCv5hx X-Received: by 2002:a17:906:f9cb:b0:c50:576f:b3a8 with SMTP id a640c23a62f3a-c513aaff1e8mr650474766b.48.1795371105507; Sun, 22 Nov 2026 10:11:45 -0800 (PST) Received: from Desktop.tail070c67.ts.net (p200300f24713a700f1770d5b08d979ed.dip0.t-ipconnect.de. [2003:f2:4713:a700:f177:d5b:8d9:79ed]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c513ae88143sm325931266b.32.2026.11.22.10.11.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Nov 2026 10:11:45 -0800 (PST) From: Julius Bairaktaris To: Jeff Johnson Cc: linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, linux-kernel@vger.kernel.org, tamizh.raja@oss.qualcomm.com, jtornosm@redhat.com, baochen.qiang@oss.qualcomm.com, rameshkumar.sundaram@oss.qualcomm.com, vasanthakumar.thiagarajan@oss.qualcomm.com, sriram.ramachandran@oss.qualcomm.com, yaojiale02@163.com, quic_pradeepc@quicinc.com, kvalo@kernel.org, sven@narfation.org, john@phrozen.org, toke@toke.dk, Christopher Griffin , Julia Lawall Subject: [PATCH ath-next v6 2/9] wifi: ath11k: enable airtime queue limits Date: Sun, 22 Nov 2026 19:11:38 +0100 Message-ID: <20261122181145.1015729-3-julius@bairaktaris.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261122181145.1015729-1-julius@bairaktaris.de> References: <20261122181145.1015729-1-julius@bairaktaris.de> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Without NL80211_EXT_FEATURE_AQL, mac80211 applies no airtime queue limit, and a saturated download moves every queued frame into the hardware TX rings. Set the bit. mac80211 estimates each frame's airtime from the rate ath11k reports through ieee80211_tx_status_ext(), and charges its 4 us floor while that rate is unset. Only the PPDU stats set it, so single pdev chips, which take the rate from the tx completion instead, would stay at the floor; set it there as well. With the series and the AP pinned to VHT MCS 0, a TCP download to one 1x1 VHT80 station keeps 22 Mbit/s while the sender's mean RTT falls from 526-587 ms to 42-44 ms (three interleaved runs per arm, default limits). Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.9.0.1-02146-QCAHKSWPL_SILICONZ-1 Signed-off-by: Julius Bairaktaris --- drivers/net/wireless/ath/ath11k/dp_tx.c | 6 ++++++ drivers/net/wireless/ath/ath11k/mac.c | 1 + 2 files changed, 7 insertions(+) diff --git a/drivers/net/wireless/ath/ath11k/dp_tx.c b/drivers/net/wireless= /ath/ath11k/dp_tx.c index 0e3b4e836001f..081e79d3759c5 100644 --- a/drivers/net/wireless/ath/ath11k/dp_tx.c +++ b/drivers/net/wireless/ath/ath11k/dp_tx.c @@ -578,6 +578,12 @@ void ath11k_dp_tx_update_txcompl(struct ath11k *ar, st= ruct hal_tx_status *ts) ath11k_mac_he_ru_tones_to_nl80211_he_ru_alloc(ru_tones); } =20 + /* Single pdev chips have no other source for the rate reported to + * mac80211, which estimates airtime from it. + */ + if (ab->hw_params.single_pdev_only) + arsta->last_txrate =3D arsta->txrate; + if (ath11k_debugfs_is_extd_tx_stats_enabled(ar)) ath11k_debugfs_sta_add_tx_stats(arsta, peer_stats, rate_idx); =20 diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/a= th/ath11k/mac.c index 90a0404a101a1..6f4462b7d3f15 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -10652,6 +10652,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 Tue Nov 24 11:44:06 2026 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.218.48 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795371108; b=Qu4s7Q+hJAs3LaSdWgd6sgKvYrgrjYJNO+92z3MOb7APwSSDD41WAZVQpZ4Bf8r1BS7d geGqJfnBBKv8oPSfzNcOqeXyJtdSo78OZbK/XKqwhgLvi3pSuCIyK9uKJIVivQhkOtI+O PECfb7zOOMvTS4Y9l+rTZHPg/oTaDj8Iv9EVfOHK8m30WbWuwqCuze+RaSabsVpOYW3YK AopQGlrrHdhpWJ6pd5h1S4Ng8bZkYymnL8Fp0ZVd1qhR3SQ1vwNd+5Op35+ZDxda66rWo MiOCzgikRQaXrz7WOL+mrFF4umDXvP0uEkKmzVbbrGofNRLJ1bWzWDFVl+9ocIgY9VA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795371108; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=BeVtOudt3OEvEUEKgjiMRbOe+We3cpRPoFjUKgGxA3o=; b=0PMS6ygWkTCAGMtSxPlB+Fyt1fitemGngUkmNR+Nz3PuExoZoxPAxLn6EGQCoK0ilgSO +IlXBmG4gXYomxYL+OwLd7jAcOq4d7LdholYHZBO5RuOuFJtgfW2IeJAfMMLRkqioozdR pYEymIbOpymd9yvk2a65MDjoKr5dFbuCKWwDdsuBH6Zjq5n4AiXsG8cxPhpu2DelZqsGw Va2QK2RXXXFkdYiKx0M7mmDeZ5p7u9Q/eMJ487Pl1+600sQxUms47V0xGz3w3JgGhxt80 0Sen7JEovCsc6qtRt0m2pxM2ctlmZuv4uANh9aAz3S80/G8nX4yZkDzvnnQcwGqAVQg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=bairaktaris.de; spf=pass smtp.mailfrom=bairaktaris.de; dkim=pass header.d=bairaktaris.de header.i=@bairaktaris.de header.a=rsa-sha256 header.s=google header.b=ShK6iGtX; arc=none smtp.remote-ip=209.85.218.48 Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C0302606A697 for ; Sun, 22 Nov 2026 18:11:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C0302606A697 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.a=rsa-sha256 header.s=google header.b=ShK6iGtX Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-c5118deebcfso368826066b.1 for ; Sun, 22 Nov 2026 10:11:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bairaktaris.de; s=google; t=1795371106; x=1795975906; 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=BeVtOudt3OEvEUEKgjiMRbOe+We3cpRPoFjUKgGxA3o=; b=ShK6iGtXSiPmvcot+l2qbeJRRfK4G/z+RMo/ky2dOzglRkhYNbEAsFcXnyzpX9Gsk5 qjx8uAxWMS8u4jsAIQ8GIT29BOnb3xCXe9n63dQO57XEhA4jpbnFzr51tdaaoVwjO7yU pfnY3rapwejVrp5pq2DoFTIjl4HvQvnkJ2DmYlzh188S5FgC7gfSEPc5IHGUv1Z4Q1UB wkKYeZRpPS+VVyzdwB9cHI4nLdvrcumiFHx7JqFw+WPRJRErjcVH+9ioAhEqnGqvwCCT IStl/D5UvbXfwAMD0Bk5D4+ULo5P27PvDtl9hkttrgJz87efP4bJY087xtiCrCE353PY uYEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795371106; x=1795975906; 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=BeVtOudt3OEvEUEKgjiMRbOe+We3cpRPoFjUKgGxA3o=; b=rGrXAwQ/xc5Vn48Mfm9V+KBHLSgT0F37DCck8j48da60/xjTp/LeJjDdQKE5cDdJz2 fKI2dtJj+PQpfO0DhZhQk/tUTFUxx5u6nEoFBb1CHKH0ovd2vXiXcVLBrU2uHCMK9Hq+ z3ee7eptCKLkcd66Prw5RzVWVkFWv3JD66pwt5IpToKmaUdPVlNEqZXAtQSQyb3ZN/+J gtzFUDg4TAMWzy5esE7Mqj6bW+TLmHfNg7gLfgdclYXQdjGY5M/hu3Q32WZ1xJJbpcf5 ZgkZnRJQ4/cLErUaVr2Ip4410+kVdrAjlIle/e1WU1rqx/5g9Lwyi4OcgOLopzOkxbw5 bPfg== X-Forwarded-Encrypted: i=1; AL+hErGI9U+xbE/HipILpbh5XMfevqYlYv8+uxkubMzK6xrIGz9vdyGXyhhcLrgxJ0C1JulI9v6dJqJQ5zaYe7g=@vger.kernel.org X-Gm-Message-State: APuU4Z8LEVm2TpRQecVZFsKA+sp4qK0JsrW5LFEieLDukkNGukPXJHGJ EzNIOfeQd7GfZOJEGN9NdQTDdXjKzLIajowAGlxTvQd7rGJ+oDs3XykxXxzwJIhLbA== X-Gm-Gg: AZFdTZe4t2jWkrvP7zPJ1B1FnbtcUJshUrZLqdNGelEYRoVmMvZdDk0TP+LMsJQpVHH nSr1ApYT877IxE0xE0fSUJf05brbuV0npPXJlK0xTecep0IsmzQdg8mhxfqJy9HZ9ZLcALEyCiy 5Mt2GRCzm0HQ2ujwmkJNSWHotxpVwViXQK0yojOrK/DGYlpKyuw1/iEFxhb9nxTD0FEd1u6DvEW J1xdQi1OVR6NSqEELiJutwrdGxx2HXPR/G2HtT+7dcIL+aSXec80NNXxrPG4lKZckvWmHMWNxnf p/aDxKyjoLNxOBvZVZtfxGXU6U4G3T7EE0QwnYlCeB8bjklmECNOoOI5BvVS9vvXGfSXXy8bowU cLOCsxXzbAq8KuUGv96e4H/52CIUjoRQETXZhc/1FDqlnlmmIuRLKIWgwnFp8GKbFYSwtqnUnq0 oDxXFNfmJmbk7ZcnhPwDnPy+k24F345ASCHwMdqmp2AqKNCxG1TvthAMXcfCJiBP9Gq/qqIHnwV 4poWohghDs9lkmeDcwls/BBSN+DyKtTpzxyzxFaW+oIo1PMA4qODVVChoUDh6IRH6IMtgV4H/1L ma3QiE4Dw5aWQGl5W8LP+/ZWYodnHWrDr379fcQyqUGQkNmHlU82k55NOCQpGduPABPZwM/cah5 I7eAi4CreUddEaxPOSYoPDwSiQA9hf6QWKIPKDHFcRU18+O3c6swXlilCcZbg4J3IsqftSbPG/Z yhBhuM8omlP1yGOpTJxQGeAdiX8JquxfNy95mlPHdslZyM9rxTv3PNKBad+inaPxrlwi8mTtdLK VkbnUvwY95tegWFFFQNOtafrIp9ajdM8z0tA8SaSNUtRAdjCHaHDQUBV/QUWT4V7y11H+r0XbkW Kd+NQ1NRy/8Ic7GpRF17/FA7DFGU1K5Vni4wZyU7lhTXwR2wX1l3g3SVWMIPX2rHY4CVb7kl X-Received: by 2002:a17:907:6091:b0:c51:51f7:c9e3 with SMTP id a640c23a62f3a-c5151f7fd77mr472909966b.34.1795371106268; Sun, 22 Nov 2026 10:11:46 -0800 (PST) Received: from Desktop.tail070c67.ts.net (p200300f24713a700f1770d5b08d979ed.dip0.t-ipconnect.de. [2003:f2:4713:a700:f177:d5b:8d9:79ed]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c513ae88143sm325931266b.32.2026.11.22.10.11.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Nov 2026 10:11:45 -0800 (PST) From: Julius Bairaktaris To: Jeff Johnson Cc: linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, linux-kernel@vger.kernel.org, tamizh.raja@oss.qualcomm.com, jtornosm@redhat.com, baochen.qiang@oss.qualcomm.com, rameshkumar.sundaram@oss.qualcomm.com, vasanthakumar.thiagarajan@oss.qualcomm.com, sriram.ramachandran@oss.qualcomm.com, yaojiale02@163.com, quic_pradeepc@quicinc.com, kvalo@kernel.org, sven@narfation.org, john@phrozen.org, toke@toke.dk, Christopher Griffin , Julia Lawall Subject: [PATCH ath-next v6 3/9] wifi: ath11k: report the pending tx MSDU count in soc_dp_stats Date: Sun, 22 Nov 2026 19:11:39 +0100 Message-ID: <20261122181145.1015729-4-julius@bairaktaris.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261122181145.1015729-1-julius@bairaktaris.de> References: <20261122181145.1015729-1-julius@bairaktaris.de> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Nothing shows ar->dp.num_tx_pending, the MSDUs the hardware has not completed. Print it per radio in soc_dp_stats. Divided into the pending airtime in a station's aql file, it gives the airtime AQL charges per MSDU. Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.9.0.1-02146-QCAHKSWPL_SILICONZ-1 Signed-off-by: Julius Bairaktaris --- drivers/net/wireless/ath/ath11k/debugfs.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/net/wireless/ath/ath11k/debugfs.c b/drivers/net/wirele= ss/ath/ath11k/debugfs.c index 70922612d3fb9..ffe1f466aefb6 100644 --- a/drivers/net/wireless/ath/ath11k/debugfs.c +++ b/drivers/net/wireless/ath/ath11k/debugfs.c @@ -714,6 +714,16 @@ 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 + /* Descriptors the hardware has not completed. */ + 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 Tue Nov 24 11:44:06 2026 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.218.46 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795371109; b=Kc4fd7ir4dk+pifC3sJtdpWQwm+GNRtj5kEhepENjuel8X0HwaHNi+RF3kS3+8x3E6pi mQi5+rrQIZoCDo9vBAwRvoQQI7787EE5X07DVqak92kr+5qtf1aGdpnOdlbzJtmpDWaGc tweB8NY+UE2rRl77UJIYmaGWV02pBsfZI95K7zC0P9siq2M9adFaLfMF0TX8tMKHJr0YO ueiYsL2bHx4ISDbjJWRh9nbl2Qbtyi8NzsWXHIuFASEabweVMjJBRNhzW5IbA4NtBoc9B VpGYFy06W7tns9JRObO2JEGVNxMh7YiLeZTklnOA+rd/zn0QpV1zfhSUzG9dDVRRnjg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795371109; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=mE/A8sDoniLUUaDAUsGG7lJKqfa/94EhZzjG2JUFfCQ=; b=xDOvYWFfI+CurNCLxWUI0fNi1FlFyCubFg1EL2Ct5GijnFZaPX720YiZDAAoh3yUp5n9 k74BM83cQi3RuuJPZ4sIHPznXlM8amwVUrRRmqz5r0TJK6hJHGmIsFBgxmN8c3yoNCRGi VTen2jkdVIM4ut1XhAp6n1qvbhPckOPHLhAJVM9SI4twengMopI5F4+PDM1H1y3xv+ph8 HfBiR65UhbMOFbjoHRQ2SlG2Kmx4FrVzWxt0j17TRNnEEv3/Hp55pcCA5Uy8OHN2BB2Lm BDPxEmL/EAlBODVuWnI1NX3CvC6Cgjqbpacp/YKWH47ukV4HkKOlvCOnvpQXAYTvCtQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=bairaktaris.de; spf=pass smtp.mailfrom=bairaktaris.de; dkim=pass header.d=bairaktaris.de header.i=@bairaktaris.de header.a=rsa-sha256 header.s=google header.b=Be1CQCHM; arc=none smtp.remote-ip=209.85.218.46 Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9982A606A334 for ; Sun, 22 Nov 2026 18:11:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9982A606A334 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.a=rsa-sha256 header.s=google header.b=Be1CQCHM Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-c513a854320so432010566b.0 for ; Sun, 22 Nov 2026 10:11:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bairaktaris.de; s=google; t=1795371107; x=1795975907; 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=mE/A8sDoniLUUaDAUsGG7lJKqfa/94EhZzjG2JUFfCQ=; b=Be1CQCHMVz21lUKkuzjDUxwCH5Crn7ZDBY2BszDWbr+dZQ0FrzBwYAO5sYzNqMipfr kNDa+VoKtuMAmEnfHCCuqiIVGLuUMLkDJnUoFDEy+AOnnggf10eJLGhf8WHuIyqpYd15 dvDtNdJMJjqXXfQQsIw15xudU4wB/DwzBszsL8E8Cb694WSdchFa2pDW/DCWTkKfUhN5 xSHztUq6IdQ6hlYrMeQuBORAcCGJ8LEsBgx20gsTIshx07fjBmszT9DrHvVRtKOQ1qUJ FzxAOm0mKmWbMGCIB92e0IlnAr4bPsYRDIZwE3Vy0w2rGNkl0jZBJE06hCdw46LIV49v wKjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795371107; x=1795975907; 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=mE/A8sDoniLUUaDAUsGG7lJKqfa/94EhZzjG2JUFfCQ=; b=RUOhTJtxwztDXsaWlMAkjze50RqN61KVn+/kKlAZppO/YhFYMPXSx2bU2V441fDIq4 4fHhk/PzNJ9WsfJccpor0pmYUg8Z8vLujSxwkJCmAyEovYmchNm8eLIunOLpSg7rt1SQ unbvVR8qyd//0bfs8DKC/tlGEwm/NG1VaGF1Sobej4Y2Tp+qieqhkt06Du7rKa/7s1ll YvgsjY7NNQXzrBHFddWThFzRcRDiydEwFfejVk+B60M5SyteZ1gZzRPRjDRXfd3DWuFV CKAkg3BP2mFwpFb/u5CiRHjUpjSoaskfS5JSYmMQCpZ2ZaODWlKpfxLy2Ym31sznNMpQ IV7w== X-Forwarded-Encrypted: i=1; AL+hErE631pnCfF/k8C80JtwqzXmjQKkR1GUSZjii+ncqvZbAg5n5q1wvJnCGpl2YCREyEnbqdYIQMphxtVVZ7g=@vger.kernel.org X-Gm-Message-State: APuU4Z+Crrs6IEX9HOLiCWCT8LSrGjSsbmcHejoKORbPSx4DW6YVWo3E Nlf3rgk449hlKAIkWpo0WFLXijhaovjAZVHuEONyRVy72DvYCITN+KmonbmIpwJcDQ== X-Gm-Gg: AZFdTZf2eZEgYt4E3iWEMK0L/TPwHymke//WiPWJdEeFk6xE2eUat0AuFWwyssNAFKt j9dMR7dLo/e1Nkbsw5DzI1v+RoO1GKGOKLOsdhSExPWmj0N/ZnqesnHSAtGU+yNX5lYVbuzueuE rVF9F8AQSYMDk/v3dzmk5xwhjE1YB2YGnU4z+stoV9Gd4SvNxQPXGgZjQjvfUksoGDcKyRZWrBN gdan554BJ9SqZCf2Ma4kIolVvHZq0ZyCDWsWv3a0EONtAL5UtMHrWMn8bmOSfR4dQHKVih0lccf QpgNHC2nWuimiRa0F7XRnx74g2ctjSqEcYE4CYwluq1bmIJPZ01dTd99hHILLfVwAR7/8n6gSSw HNjOelwbn/1BL9s2cTCCRmuJ4U54eYe64NO8PKmQQgQKoXnFobaxxeQXtr9QeNuCbTIrUb934Ln JBUsW21jYvCpzgYediMklHFxaN7OmHkMNYF0S4JwjeiCSw8ITltK2KqEGZGcty3u0T5lQ2djGqi Y/UTPyt/Da5+m1Hq7fthsGSiZiOt+UNsJPHeZxk/te/d5C8L//qL0Oc3WnhooAX0/LCUgQ39/ID i8l+h0LoioQ9mLbkmGG5FdhPqgezZbIuWIzWAzDjo6QcjCj4ohrqnxubbJpp3MhuLOoRjSyx2nU TzVbe/vq7zvWGo9B/IG8gIWydfuH48chf8TmmU1kbNfwQ4rUU42LAXxFv51ez8UrsjupX1fZGBG n5Ey5YxvMRvGb8WApgYbVTSU6tR+zw6mMR1uhlHJd3e00Ho10hjRAPWg3hA4O/Gmcy1Kbkgkyc+ tBomzUplmwzuwDKw8dsUACpbS/VLgAcrfgJCwBGb6cW2B90DBQaQ/MeKXqk+z8FdfYin04UwNCK ea0iFjAvxcHt0EQMUwCKB3/VErtd9jsNU9dlbter2nS5AmFLH36mvDi8lXYZ/bjnoLTCz2PG X-Received: by 2002:a17:906:3713:b0:c50:4d71:a85d with SMTP id a640c23a62f3a-c513aac5448mr605392366b.32.1795371107075; Sun, 22 Nov 2026 10:11:47 -0800 (PST) Received: from Desktop.tail070c67.ts.net (p200300f24713a700f1770d5b08d979ed.dip0.t-ipconnect.de. [2003:f2:4713:a700:f177:d5b:8d9:79ed]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c513ae88143sm325931266b.32.2026.11.22.10.11.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Nov 2026 10:11:46 -0800 (PST) From: Julius Bairaktaris To: Jeff Johnson Cc: linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, linux-kernel@vger.kernel.org, tamizh.raja@oss.qualcomm.com, jtornosm@redhat.com, baochen.qiang@oss.qualcomm.com, rameshkumar.sundaram@oss.qualcomm.com, vasanthakumar.thiagarajan@oss.qualcomm.com, sriram.ramachandran@oss.qualcomm.com, yaojiale02@163.com, quic_pradeepc@quicinc.com, kvalo@kernel.org, sven@narfation.org, john@phrozen.org, toke@toke.dk, Christopher Griffin , Julia Lawall Subject: [PATCH ath-next v6 4/9] wifi: ath11k: report tx airtime and enable airtime fairness Date: Sun, 22 Nov 2026 19:11:40 +0100 Message-ID: <20261122181145.1015729-5-julius@bairaktaris.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261122181145.1015729-1-julius@bairaktaris.de> References: <20261122181145.1015729-1-julius@bairaktaris.de> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" mac80211 charges the airtime deficit only through ieee80211_sta_register_airtime(), which ath11k never calls, so with NL80211_EXT_FEATURE_AIRTIME_FAIRNESS alone every station stays in credit. Register fes_duration_us from the PPDU stats, which ath11k already adds to arsta->tx_duration, and set the bit. The TID comes from the ack/BA status TLV, sent only for a PPDU that drew a response, then from the completion or rate TLV, then BE. fes_duration_us is the duration of the whole PPDU, from the common TLV that all its users share, so each user of a downlink OFDMA or MU-MIMO PPDU is charged the duration divided by num_users, in arsta->tx_duration as well. mac80211 takes only local->active_txq_lock[ac] inside the call, which runs under ar->data_lock and ab->base_lock. 'iw station set airtime_weight' fails with -EOPNOTSUPP before this patch and succeeds after it. Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.9.0.1-02146-QCAHKSWPL_SILICONZ-1 Signed-off-by: Julius Bairaktaris --- drivers/net/wireless/ath/ath11k/dp_rx.c | 23 ++++++++++++++++++++++- drivers/net/wireless/ath/ath11k/mac.c | 2 ++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless= /ath/ath11k/dp_rx.c index 6d95f7b343a55..777c56e416aed 100644 --- a/drivers/net/wireless/ath/ath11k/dp_rx.c +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c @@ -1382,6 +1382,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))) @@ -1400,8 +1401,12 @@ ath11k_update_per_peer_tx_stats(struct ath11k *ar, usr_stats->ack_ba.info); } =20 + /* fes_duration_us is in the common TLV, one value for the whole PPDU + * that every user's stats repeat; a user holds its share of it. + */ if (common->fes_duration_us) - tx_duration =3D common->fes_duration_us; + tx_duration =3D common->fes_duration_us / + max_t(u8, common->num_users, 1); =20 user_rate =3D &usr_stats->rate; flags =3D HTT_USR_RATE_PREAMBLE(user_rate->rate_flags); @@ -1490,6 +1495,22 @@ 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 names the TID only for a PPDU that drew a + * response; fall back to the completion and rate TLVs, then to BE. + */ + 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 6f4462b7d3f15..eca16a151d068 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -10653,6 +10653,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 Tue Nov 24 11:44:06 2026 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.218.44 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795371110; b=h0q3NpBoeyg8Y89FolK+bBljTVm4nV48gs7nCnGpLzdMo82t6TIIw/GELX1xrxzwcnr1 sog1Cue08Xw+nYCQkHHhyEid+I003zQe2zn5CKxS71qL6rBCNF5/CJkQsjJ2HWRUFipsU 00XRNVWiEn2lRwj4MbeXfL+FicFDmnr8CEFnruAgdM2kpecwqUncLaIUvxcSzeh7zC+Yx 0TQgDQAJgOAyoxTFwo1QnBr4wGlGEJH0dto7dESU4ADVYVoaz+nKS/83VV5ksJgcfYi2r llm/siITMNeOL1BiSNXi6zhcHOLmaPgsCisEzCW+cUlBQ+nVlpsWkxzArG3Xi5KV1FA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795371110; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=tHmt/1DGc6z6bOlU+pcZZ2IuvF/j7mYPG2xCczPpUEo=; b=lH4CQrprfw2b2zURJnYF2dBDUxuKI8V0HpuX7iispgN0hpV24D/n/0gKpyK12QRxH4O7 tqmQHo9HfaDFYbJY6Pt3OoznU6SQcx9rFP9U1EIbox0SkiYD7c1prLL8o5Cnxnlws+RaU rHq9/v5nxmA2UCSsnTxQzmkhS+0chb3o7fv8W5gFKGBM+8es7cZf12kAyh/59x5GoXN7E uOrHA+GyqjFM+rugUjwNBq6z128yxwcSNr+Cx4JgFnMAycfWkYeaiX1SpVawUFNdpV8Cj nXrBDJ93EnM8wJPWq916B+77jL4PxI4fIbncO2W2xkrhmPg5BZhXCTlEzEgQVSzQYfQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=bairaktaris.de; spf=pass smtp.mailfrom=bairaktaris.de; dkim=pass header.d=bairaktaris.de header.i=@bairaktaris.de header.a=rsa-sha256 header.s=google header.b=W3S7r0ZL; arc=none smtp.remote-ip=209.85.218.44 Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6EE03606A6BA for ; Sun, 22 Nov 2026 18:11:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 6EE03606A6BA 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.a=rsa-sha256 header.s=google header.b=W3S7r0ZL Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-c50a4a2132cso355402966b.3 for ; Sun, 22 Nov 2026 10:11:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bairaktaris.de; s=google; t=1795371108; x=1795975908; 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=tHmt/1DGc6z6bOlU+pcZZ2IuvF/j7mYPG2xCczPpUEo=; b=W3S7r0ZL9dqoJ9GdxjtfUkgrLFyhI2d1ijPq4lFDYz7vE7lZTPG9E0eXWmbK0oBR7D lt/KFbJRtDxGFk9IY3HKWdf+NVvro+4CK4ZOjjL0CHMzOI2vfHdpMV5kU/2U2lBcmY5t /09rPEu84COQxAJh+JSzZUo9DHxtFZGPyFJcwASghsnA9wX7lOzcjhIAe2W83z81fZDM ZsObyz5jhynHuNQFNQQKVK2ys46iNT+FHNcf5tdMHto4LYNPb48P2ArO/TMfrZSUSOEI hDSnlBcudvMpGQOGQKHgrpKS5hGVB9dhTE3CRAypSre3Dq+BLAXhgnL3Yedsma4P0VYh U21Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795371108; x=1795975908; 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=tHmt/1DGc6z6bOlU+pcZZ2IuvF/j7mYPG2xCczPpUEo=; b=o4xHOVywpClS1fPQOU5e9dbnotX1bSAlucfIp6Vrp2kqamIzQl7aXiG966Neg5gdxq vtLYNui3Cq4pSNborLMys+FQOmWXTb1D8tjyDtIOTaMCIvS9JKmdPrR3P+NYp/cbUau4 cQ3uNSImzxXT3uMCT3PTWoiHWdoaZtGNw/MG1mlYmgmsIBGuwrmsgDT7+nWkaZOLKcvj uzBhC7WsMyFHwG8iGPaXeZe7X8MPda38W2DskotveMMOcrA7TtMo59hxak7CN3VKnQYj PS6xmq4dWg5kG43Ww5T3J/gAXPb6lE041t9tZiWv0ug8HUS/vrY6053rekyh3HlCEHmC r4Ww== X-Forwarded-Encrypted: i=1; AL+hErEYmFBINUA7mEe6waTT/BUMTaImFDNHs84KmKY6q3ykbogiJBkGX+JGzZxciQ1gJQmP47/E14U0PriGuUg=@vger.kernel.org X-Gm-Message-State: APuU4Z9Hb1uh1JGSv+A8gSwNWTVXM13/orHNXMim6cb3iTp+viJ6Get/ ycSQ1h3fS9aM6+neQ9EoURW1OKoiwrGWC/tEAJ7X1nD1w81SUeeohcs9AbGb+fR5Dg== X-Gm-Gg: AZFdTZcWMDERJsfbLD5WfqJDrZatHvfIz+vooKHST8RNqi8WI6PXntiwJgO8xUP9alL XYS8kbSNCmlsoVs4f3LKn1fCbmkKyYE8oPLToLbUyCjHIYA1+KKvVDLa38g++sGm2Jsbmx+heXb cDtf9wYnWmgxsAf3T8gZEsEZ1Nbcm7HRdqkEcBwzZu8V9DjJX1qFYeSP4oBb/Bby1DXgznpYEiB s+v3TPy+1Bc5DvMVryyuFL384vgzhDF5lnxSBiQhpGiRorll6Gmrp301gbJ6s20KTUoRN+po/Qz 37+eQ+z68XN3WyYVY/zqSg2hN7JKEq/BCMEXsuM7Icsvjp6yJeKuIQIjpdsLW8VKfIFk15lC5aF b1MaxM3yuBAYWJRIv5+8HXSP2A1L1xncACxaHI2TeOSCELoyvFP4Tc/eQk5VnD09hsuTiBEEgEr K/kFv3c3BZozAeh9t83L4G/jkcl40Yi1ITN0kN/+RdDqtnhdkzlOnM/WxAa6Vuk7+Y9rPa2CaZD UdwIK4YR0jnPzckjZLZvjnRzpDdV/I/8ZysVIiEcPpBNTaOVp7XvJEcBDKUvJCevtYTTe9P2Xp/ GRmGMdC9B5sXBUX4MzoAtno6WlDv0cpxrBIrut74Yh6ZiZe1crctvLeTmot9arzuWnQPC92Yf/p NU8YS1I/AetIPZJkk0i8fOcq8/FlAFgJBDMQALsXREzvPyoQLD0HeQQvSydu2qBW7yikkA6SJV7 t5BdlHUgh3jjK7siYKQDY6r68lEi+29EwPcnPXvs+S3IjD1cWlVIGbcuYgav4IXgYByy6D6o13y k7gLD1iy+xN4cf8PBc/CMJn8aaY1xybBwaoCO1CIpkiNecMzfI/qWStr/J6u6HxRaGnj8x2TyX5 Txc38bOnb4VibXT/MyPmA64z38m9YMLwW5IWszim7hg9v/XU4NrlgWzrnAZQ0H7Coccz1v7s X-Received: by 2002:a17:907:ea8e:b0:c49:a235:8e0c with SMTP id a640c23a62f3a-c513aadb22dmr721786766b.22.1795371107843; Sun, 22 Nov 2026 10:11:47 -0800 (PST) Received: from Desktop.tail070c67.ts.net (p200300f24713a700f1770d5b08d979ed.dip0.t-ipconnect.de. [2003:f2:4713:a700:f177:d5b:8d9:79ed]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c513ae88143sm325931266b.32.2026.11.22.10.11.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Nov 2026 10:11:47 -0800 (PST) From: Julius Bairaktaris To: Jeff Johnson Cc: linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, linux-kernel@vger.kernel.org, tamizh.raja@oss.qualcomm.com, jtornosm@redhat.com, baochen.qiang@oss.qualcomm.com, rameshkumar.sundaram@oss.qualcomm.com, vasanthakumar.thiagarajan@oss.qualcomm.com, sriram.ramachandran@oss.qualcomm.com, yaojiale02@163.com, quic_pradeepc@quicinc.com, kvalo@kernel.org, sven@narfation.org, john@phrozen.org, toke@toke.dk, Christopher Griffin , Julia Lawall Subject: [PATCH ath-next v6 5/9] wifi: ath11k: schedule TXQs from the driver Date: Sun, 22 Nov 2026 19:11:41 +0100 Message-ID: <20261122181145.1015729-6-julius@bairaktaris.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261122181145.1015729-1-julius@bairaktaris.de> References: <20261122181145.1015729-1-julius@bairaktaris.de> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The wake_tx_queue handler serves only the txq mac80211 passes it, so there is no deficit round robin between stations. Run the round in the driver: walk the access category's active txqs with ieee80211_next_txq() and drain each through the TCL ring check until the airtime queue limit binds or the queue empties. A full ring ends the round, since all txqs of a round share it. Each round holds a per-category lock, as in ath10k, because mac80211 forbids concurrent rounds on one category and the next patch also starts rounds from tx completion. The design was proposed for ath11k in [1]. 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 Signed-off-by: Julius Bairaktaris --- drivers/net/wireless/ath/ath11k/core.h | 5 +++ drivers/net/wireless/ath/ath11k/mac.c | 44 +++++++++++++++++++++++--- 2 files changed, 44 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/= ath/ath11k/core.h index a0d725923ef24..40895d276de5f 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 eca16a151d068..226e1417ffe74 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -10078,13 +10078,12 @@ static int ath11k_mac_op_sta_state(struct ieee802= 11_hw *hw, return ret; } =20 -static void ath11k_mac_op_wake_tx_queue(struct ieee80211_hw *hw, - 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 ath11k *ar =3D hw->priv; + struct ieee80211_hw *hw =3D ar->hw; struct dp_tx_ring *tx_ring; struct hal_srng *tcl_ring; struct sk_buff *skb; @@ -10097,6 +10096,10 @@ static void ath11k_mac_op_wake_tx_queue(struct iee= e80211_hw *hw, tx_ring =3D &ar->ab->dp.tx_ring[ring_id]; tcl_ring =3D &ar->ab->hal.srng_list[tx_ring->tcl_data_ring.ring_id]; =20 + /* ieee80211_tx_dequeue() applies the airtime queue limit, so a + * selection ends where that limit binds or the queue empties. A full + * TCL ring ends the whole round. + */ while (1) { if (unlikely(test_bit(ATH11K_FLAG_CRASH_FLUSH, &ar->ab->dev_flags))) @@ -10110,7 +10113,7 @@ static void ath11k_mac_op_wake_tx_queue(struct ieee= 80211_hw *hw, =20 if (num_free =3D=3D 0) { spin_unlock_bh(&tx_ring->wake_tx_lock); - break; + return -ENOSPC; } =20 skb =3D ieee80211_tx_dequeue(hw, txq); @@ -10123,6 +10126,34 @@ static void ath11k_mac_op_wake_tx_queue(struct iee= e80211_hw *hw, =20 spin_unlock_bh(&tx_ring->wake_tx_lock); } + + return 0; +} + +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))) { + 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); + + 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); } =20 static const struct ieee80211_ops ath11k_ops =3D { @@ -10817,7 +10848,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; @@ -10851,6 +10882,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 Tue Nov 24 11:44:06 2026 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.218.46 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795371111; b=Ppo7k08vYd/m9ZiMqPZIESch8ye+EBCdLdh0w0ug/tZaz5C6WaLW1MPxFYlBdDk066C6 yt6O5oLCf2rX4XcEjh+qaWdtWU5hw0q0TTPQuahHfcdTddagczHsRUugffL1C6NihAYQq mv3Tso9h3jNX5cb3KhSogVGlA7cYqjYmFwNVljZlAVQmurQI2fywEkuW7t+jC0St8zWzg caNTw09ju0enlRxtHdjC/KT3ZC5kqA61y8/ygkiVVW8FUSXcgG0I5sLW1uLdECo0q5dlz lmNG0DlZP5j8QD00L1aSf0r8X7xAGglBmCWcjaHkPr++N2hDR9yw/mOpRJezbWHIxlA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795371111; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=QPQ6Z0+Ejkb86/QqsMqCsz6Be6K0g3JHqbeFjXLeLac=; b=bYt/0aGGzyoHPb+aPUVo0yrKR2b0Jm8xdu1vGcjs76cqdDQlAK61K3pRqyENlj1gCHEe Rk6ybS3NKMSKvbuo4b6ADy1Ity7h3RN7f+qo0iwxBg+coRn5AFMoacEere2LC3+ZVaLLB kSALQrgAMAIstkRCLU7WlkVM5/+soKMU2gteclP9ea78CmlM4027KCI0V9VxaQM1K/AKc EssTBoAQ00BJSCH1qhVWACt8M9clYXkn/hcVv6fBv+5JXADgimVut3E0PY2y8YHXN5qr8 sZJ0VdnNYFq58r5ewbdBXch9tg6nxcgkyX7CCo0nq0xJxLJgGNBH7tXsk6nkdeSmLTw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=bairaktaris.de; spf=pass smtp.mailfrom=bairaktaris.de; dkim=pass header.d=bairaktaris.de header.i=@bairaktaris.de header.a=rsa-sha256 header.s=google header.b=P2BF8BbE; arc=none smtp.remote-ip=209.85.218.46 Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5282F60A2609 for ; Sun, 22 Nov 2026 18:11:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 5282F60A2609 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.a=rsa-sha256 header.s=google header.b=P2BF8BbE Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-c4d28f75d62so427849366b.0 for ; Sun, 22 Nov 2026 10:11:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bairaktaris.de; s=google; t=1795371109; x=1795975909; 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=QPQ6Z0+Ejkb86/QqsMqCsz6Be6K0g3JHqbeFjXLeLac=; b=P2BF8BbEr4Fus4fFKk+CbC5C0+w4m9qkCX7anjEBqS9boBEmAE1ITiNiUqKA43igVC 4HMQ3Uny2BwhtSyZCqhz5um6WdbvZMbvzc+ZeFR6Zv2uLHcJhZn50FsR79OQrMzDUuv4 yQxovLO/dptSaN354PiEJQe6FUNBQeSA1eKUYpUAayh+tkZEgfS6TD8EZTCGwvhHyqI8 DBXzGX1dC0RI1P9Su8UnpAGIVRxvlQBvBiNckhHWWAo4SvGhFtIEHWSkupgQkCzkbxA2 HW9JWRcO+eWBzYaAe+W3msrknu0NF//S9jd4ZMCMifsrm/tb8wDZt1/JUb8unCjsq2/k dhMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795371109; x=1795975909; 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=QPQ6Z0+Ejkb86/QqsMqCsz6Be6K0g3JHqbeFjXLeLac=; b=rMVp1Hl1Nu9wXhbj7hcwJqKGFx2C+HyFYJ96NepBnz8OYgOWjPPHJLCfSQYRvY39HP rBNGQk8u9Vy4j2WwXCagKnbvJloRuXqJpdbvGIigX/v5VVLQ4u5r4t3HWo97JGxjb7pL iTiyANsK0vqPqjJ5opdh4SjkATFQcUBGhmBnecqwySCVON+7vGUlCAZ+qdHQykQHmHdO jxcceYf3rTGHQFGw7VGV/T77ko/K5C9PO5Grs40+PJg8vAqDerINZYw038KtFguib3YZ 656a+4RPVqb7a74pZD4rjvMUcTTOt7qDNlFPhutXije41eUmLJbvJuW7MOuiJvJ+p4xh VOgw== X-Forwarded-Encrypted: i=1; AL+hErFq98uM6W6Qa8o3iPhTQLxEdbm5gaj6vUg92b73JaineLEJVeM8rpHjNA8ThcBob7b3Z8dYtMHkd7fkyPw=@vger.kernel.org X-Gm-Message-State: APuU4Z/wuMP9XcRaXaGdvvKpwNOxE87ha2yNXB1etJriJR4jBs3R92p7 pCXG8XWviVy87wgmpjEPEisR2Tea+er5FSR7pjkDfHDqDNZxeGLdmAgyn8YloZGyDg== X-Gm-Gg: AZFdTZfsfXTaUIkZ1wsxB0rkVe2fCwKTIMPjPQyxHXv4L4SJ+k+g7/QvAWu8r8k5Ucj 9nx6pMC6btzohUGsewMOqUP18iKSp9USm+fIf06zj2Oybn5FQ38Rup2hR8n5e/ISPdsqHKxjtcV 2QJ2MUCrlvY9owB0JYSPza5QMbgIdPadZWnRBSs+FHSj9V63btCNzduQ5Ul3tGaWKN2SHEpxToz rW2ju8kVNIKkADOgX9jehEF394bjBNZOYY/bwVSNhEOrO+STXO/kD+QFsNRvQNj+8YVEWzgKK7t /P07hzVgulc1xK6j5YeQuadrY2bqBT9zyq2HuBelF0zD6NShG114JkjqG+L3/uqf2WvH0M412uE GRfXMwBqyTyE9Y8Li/BA6wc8i8pAGoDq8mU+rfF2EtybVlIAOK7+yZ/Mz8mjt0UEJfmfVkg+JgS dLJKe951sXLtjOunxaqV7Le9Le4gyhvTahSHZ+xLuw93IbzQXiCU2K/09NtSY/zZ8oXu5791EOi 9NPm9YXpTr/Nw07A+NKp8z8XZVa81hRJVo73gG5HIJBd0Li/lXqIXl2VGKS0JJPMtUhE6Qs2xJd izvUggxGQxCo2QT221MCffEiHwt6yK7B47FrGYv48O6ES5lSb9Ca52amyuZLY77x+OGzuu73ULt OBgrSYB08telpDHF88T9FNAxtTvawNHRavvtwFQrJnPLsNULt8Oion6xHVy0lZTSFJSfX+WxY/N PDAzIVsylfa67fL7NZdsEQNInJdWUU1f0gERrZa9JY82ueu+cxYMS8JDrVuhYE1nX6EaJAQKAOF rdaUuyBIhUdmo7AoewY0hn98SJzC/2lXwk+YUZlDBH3fgy4H4h63hbC2oWK4GZlU1HwbPzEElkx vuXXeB9uAd/aoV6zEjveheqOj/Zxb8P0M6wL7TNBdHlp4LZy3l3R2KOjF+ksFrZ5pLWLSESA X-Received: by 2002:a17:906:3814:b0:c41:cf68:bbcf with SMTP id a640c23a62f3a-c513ab497afmr548454966b.32.1795371108676; Sun, 22 Nov 2026 10:11:48 -0800 (PST) Received: from Desktop.tail070c67.ts.net (p200300f24713a700f1770d5b08d979ed.dip0.t-ipconnect.de. [2003:f2:4713:a700:f177:d5b:8d9:79ed]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c513ae88143sm325931266b.32.2026.11.22.10.11.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Nov 2026 10:11:48 -0800 (PST) From: Julius Bairaktaris To: Jeff Johnson Cc: linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, linux-kernel@vger.kernel.org, tamizh.raja@oss.qualcomm.com, jtornosm@redhat.com, baochen.qiang@oss.qualcomm.com, rameshkumar.sundaram@oss.qualcomm.com, vasanthakumar.thiagarajan@oss.qualcomm.com, sriram.ramachandran@oss.qualcomm.com, yaojiale02@163.com, quic_pradeepc@quicinc.com, kvalo@kernel.org, sven@narfation.org, john@phrozen.org, toke@toke.dk, Christopher Griffin , Julia Lawall Subject: [PATCH ath-next v6 6/9] wifi: ath11k: run the TXQ scheduler on tx completion Date: Sun, 22 Nov 2026 19:11:42 +0100 Message-ID: <20261122181145.1015729-7-julius@bairaktaris.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261122181145.1015729-1-julius@bairaktaris.de> References: <20261122181145.1015729-1-julius@bairaktaris.de> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" A station at its airtime queue limit gets airtime back only when the hardware completes its frames, but ath11k starts a round only from wake_tx_queue, so the backlog waits for the next frame from the stack. Start a round for each access category, taken from the frame's queue mapping, that a reaped completion belonged to, whether the hardware or the firmware released the frame. TCP download from a wired host to one 1x1 VHT80 station, BE aql_txq_limit 500/1000 us, 20 s, three interleaved runs per arm, sender RTT: Mbit/s RTT mean ms RTT max ms with this patch 94.5, 94.4, 94.6 68, 62, 67 126, 135, 121 without 74.0, 78.5, 72.4 28, 27, 27 55, 40, 40 Without it the link idles between arrivals, which also lowers its RTT. At the default limits both arms reach 88 to 95 Mbit/s. Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.9.0.1-02146-QCAHKSWPL_SILICONZ-1 Signed-off-by: Julius Bairaktaris --- drivers/net/wireless/ath/ath11k/dp_tx.c | 33 +++++++++++++++++++------ drivers/net/wireless/ath/ath11k/mac.c | 7 ++++++ drivers/net/wireless/ath/ath11k/mac.h | 1 + 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/dp_tx.c b/drivers/net/wireless= /ath/ath11k/dp_tx.c index 081e79d3759c5..0cdc0493f10d2 100644 --- a/drivers/net/wireless/ath/ath11k/dp_tx.c +++ b/drivers/net/wireless/ath/ath11k/dp_tx.c @@ -286,7 +286,8 @@ int ath11k_dp_tx(struct ath11k *ar, struct ath11k_vif *= arvif, =20 static void ath11k_dp_tx_free_txbuf(struct ath11k_base *ab, u8 mac_id, int msdu_id, - struct dp_tx_ring *tx_ring) + struct dp_tx_ring *tx_ring, + unsigned long *push) { struct ath11k *ar; struct sk_buff *msdu; @@ -307,6 +308,8 @@ static void ath11k_dp_tx_free_txbuf(struct ath11k_base = *ab, u8 mac_id, dma_unmap_single(ab->dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE); =20 ar =3D ab->pdevs[mac_id].ar; + __set_bit(mac_id * IEEE80211_NUM_ACS + skb_get_queue_mapping(msdu), + push); ieee80211_free_txskb(ar->hw, msdu); =20 if (atomic_dec_and_test(&ar->dp.num_tx_pending)) @@ -352,7 +355,8 @@ void ath11k_dp_tx_free_pending(struct ath11k_base *ab) static void ath11k_dp_tx_htt_tx_complete_buf(struct ath11k_base *ab, struct dp_tx_ring *tx_ring, - struct ath11k_dp_htt_wbm_tx_status *ts) + struct ath11k_dp_htt_wbm_tx_status *ts, + unsigned long *push) { struct ieee80211_tx_status status =3D {}; struct sk_buff *msdu; @@ -375,6 +379,8 @@ ath11k_dp_tx_htt_tx_complete_buf(struct ath11k_base *ab, info =3D IEEE80211_SKB_CB(msdu); =20 ar =3D skb_cb->ar; + __set_bit(ar->pdev_idx * IEEE80211_NUM_ACS + + skb_get_queue_mapping(msdu), push); =20 if (atomic_dec_and_test(&ar->dp.num_tx_pending)) wake_up(&ar->dp.tx_empty_waitq); @@ -426,7 +432,8 @@ ath11k_dp_tx_htt_tx_complete_buf(struct ath11k_base *ab, static void ath11k_dp_tx_process_htt_tx_complete(struct ath11k_base *ab, void *desc, u8 mac_id, - u32 msdu_id, struct dp_tx_ring *tx_ring) + u32 msdu_id, struct dp_tx_ring *tx_ring, + unsigned long *push) { struct htt_tx_wbm_completion *status_desc; struct ath11k_dp_htt_wbm_tx_status ts =3D {}; @@ -451,12 +458,12 @@ ath11k_dp_tx_process_htt_tx_complete(struct ath11k_ba= se *ab, else ts.peer_id =3D HTT_INVALID_PEER_ID; =20 - ath11k_dp_tx_htt_tx_complete_buf(ab, tx_ring, &ts); + ath11k_dp_tx_htt_tx_complete_buf(ab, tx_ring, &ts, push); =20 break; case HAL_WBM_REL_HTT_TX_COMP_STATUS_REINJ: case HAL_WBM_REL_HTT_TX_COMP_STATUS_INSPECT: - ath11k_dp_tx_free_txbuf(ab, mac_id, msdu_id, tx_ring); + ath11k_dp_tx_free_txbuf(ab, mac_id, msdu_id, tx_ring, push); break; case HAL_WBM_REL_HTT_TX_COMP_STATUS_MEC_NOTIFY: /* This event is to be handled only when the driver decides to @@ -736,9 +743,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 @@ -782,7 +790,7 @@ void ath11k_dp_tx_completion_handler(struct ath11k_base= *ab, int ring_id) ath11k_dp_tx_process_htt_tx_complete(ab, (void *)tx_status, mac_id, msdu_id, - tx_ring); + tx_ring, &push); continue; } =20 @@ -798,12 +806,23 @@ 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 * IEEE80211_NUM_ACS + skb_get_queue_mapping(msdu), + &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 in that access category 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 * IEEE80211_NUM_ACS) + ath11k_mac_tx_push_pending(ab->pdevs[i / IEEE80211_NUM_ACS].ar, + i % IEEE80211_NUM_ACS); } =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 226e1417ffe74..4527ab6977d04 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -10156,6 +10156,13 @@ static void ath11k_mac_op_wake_tx_queue(struct iee= e80211_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(); + ath11k_mac_schedule_txq(ar, ac); + rcu_read_unlock(); +} + static const struct ieee80211_ops ath11k_ops =3D { .tx =3D ath11k_mac_op_tx, .wake_tx_queue =3D ath11k_mac_op_wake_tx_queue, diff --git a/drivers/net/wireless/ath/ath11k/mac.h b/drivers/net/wireless/a= th/ath11k/mac.h index 127cb476b44b7..b78a357b5472e 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, u8 ac); void ath11k_mac_peer_cleanup_all(struct ath11k *ar); void ath11k_mac_tx_mgmt_pending_free(struct ath11k *ar); u8 ath11k_mac_bw_to_mac80211_bw(u8 bw); --=20 2.53.0 From nobody Tue Nov 24 11:44:06 2026 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.218.47 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795371111; b=fiTLHoMTCN88JDXTL5fule5ckxgdinuioBZLoN2kW7k2lIzmmHOPteV5GEALy/a+QCCx zfOqy+f6rIpNPgH1DxUKsJ34yAR69+ulf4aM5nFUnzJWeuDu4UVOylAYFPswGU7TNKmmp hj/W4TSG+xa5zLq5ocZYG5pAmYD762Oh0vr/Js76mzoBsU8KeaAY10IjsmOHYppEYwLyf zv/e6N4j3dn0LC9KfWOAlNXSRLv16bB5FLuhBi0PIEitpWMivuk8XR6LzBbTtJLN0NxZw 8Xn8oVAmou9sHXdb31YrtxN/ekgTiWkpjagpatYwU/SzJDp8N0EkimM2tMiA9zNSpkg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795371111; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=KP7khDe++7fc98wXYbOy2kUEZEGprttgeO7wiuURcgo=; b=ztfWVZtgWb6LUaV9378S2qmaKfiHwljoLXDLgqGODmPdxpghsIO4pf/iEn8HI5TZsWR+ Z10lMiWFD3/VWEohAi07AxFAe47dVKtR1MYSGlh7J9L3inVJZZwpAUeFOpTdFt22gVu3R Z0bAKXZoKccpmsTY0VMqz6NgIErgMEl+BVLnGfbevBTU1QzL5zL9vO/LMggkaHKMOhIa3 76/qlajI76hNKJlqq2vzFqtcpidug7frt7pGdIeb/6geBhWxs5mpWhypuAqBPLRGY/Wqx rigLbKXRK6EB8jVWx4/Fxsk96tSCrEecIK9GSmaaeuYhriWtchBCss37P+aWMLdVqMA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=bairaktaris.de; spf=pass smtp.mailfrom=bairaktaris.de; dkim=pass header.d=bairaktaris.de header.i=@bairaktaris.de header.a=rsa-sha256 header.s=google header.b=eWZxsdTT; arc=none smtp.remote-ip=209.85.218.47 Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 15945606A699 for ; Sun, 22 Nov 2026 18:11:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 15945606A699 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.a=rsa-sha256 header.s=google header.b=eWZxsdTT Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-c50d3ac6b51so762506366b.1 for ; Sun, 22 Nov 2026 10:11:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bairaktaris.de; s=google; t=1795371109; x=1795975909; 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=KP7khDe++7fc98wXYbOy2kUEZEGprttgeO7wiuURcgo=; b=eWZxsdTTy5LP8T69/vEVfk3Vv51q1FIr/ibktW+61VnmQljeFT5gq6uNMt36e+wYyc i4kEH2xlD90NmxVefmdG8dTxLjwb4QE4CqNksI4MIyRxJ03pyiZ9RnaBmb3A9eKEMBht PluKCUBKGYEeXBtPKTt1l7sRa0+hKV91yh6ZwNyOuOCiFWAArAwus35LZmEd+e4Xvue0 m0qaHxUuM+8EC7E4utiSxMfetGoY2pVAR7sdslVEM/U65opPBKgJvfc0Kz7DElK+EQCo +Z1LJuKza70WKElCSo6MfCOfxlsaeAC+0TSeqSBNEUb31eZKeIOzyg2VP0uHa3OeuUzB KPjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795371109; x=1795975909; 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=KP7khDe++7fc98wXYbOy2kUEZEGprttgeO7wiuURcgo=; b=Vx37Kh2QW9yQUSdvtR3y9SvuGhafBkSAC5iKe6vdKzoH0gwnSYSYRh2KBdo99aIknV MUXO4XHSUX/8bbXM9y9+9niphNwtlae2XVcBoIVmFRVrW0O7UcyN+KH+d9CoGLbtALHD vj66YRjJ7iNuIo6QSOIru6NleuM4YxCAbbNSUkONNhjyND8EEDRf77TRSfH2r2mK/kVR l9N8TlfeL7HbQfGVzk+tAfY97g2FE8Da6PvNA8fP9QxUT3TpIyVVgH0JfwflQIhoLMux MDpYtQICFxFz6wS0YkDFcTRcnR6UGN6HOy+g7+zK/87ZcuXipW+XDli0Mz9zmeVxOVJk v0Ew== X-Forwarded-Encrypted: i=1; AL+hErE5pArl9VjLe5n2WVzOR9kD4kiZd/NX5HcJkKG0R3wmyGWZekMIUWP0G4/5FWwDqHVjvT8dGoE3Obg0iYo=@vger.kernel.org X-Gm-Message-State: APuU4Z/WOBEpHsC3WIE1Nj5jgHiKOqhEGbCCDylYuls3rsz9OLCdxE9F jbF25rupnaaoWHrxOvMSHU2IM388CjLq0POIBDX29FZLt8Z/4maLzRApQEBg+SiCkQ== X-Gm-Gg: AZFdTZcOo+DPNA27bacPTHDR/LMpzOCVJwTBpmcqNtfXcJuwEeGD1D11VxhKFGO2SYC CeJK+XpdeOS6lgRE2aXqAPZhsJQTpGgTVUa0epZsSUOWB0bp8TTRZhgP00jtbDtClwwhx/LAmHD EfzS+V1itGDL2ad/+t2UsX0/xgFm9BmLJDPQm6MvOanG/Iq05KpAFrsgEPXBtUEbIliAnWosTAG tZhA6Rfigo2JrNReAASPdoxhoNs6NwQPIKSwJEiIlSp2WjHKwfE7+eV1PUqQOB4Z4/Q9leFGqz3 rwLepd+AptNxE7LxPhaSYQZg99gHX8+VgHrLc2k5+R4b4NREai8ErWDQXMDJBISJ00hTjaJ1uSv LN+5MfHpPLeYOJ68yLEiwaGsCr/I1Vk+32Ixrjm1r13bw8hP3G/mjFcO9CzaDZW9A7uYD7Y88vZ FgFXKOdH1Hm6s9/cgstAC5obcahz3Wbp444KmbUJyI4uJppQeBZNuas1tEYMZoBHVBM+4kTRewc iqfa6umnMPJ27wVA/r8qhVYhv5q7WBrlWt4J6uWw7vxzKfAhPfiM7qk+cYR0+C3Ft6+mjdXCiz2 ZZ4X2P35vBhmKJfUUXpquHAksgsdPayd02jqTagqKqN7IQtawQl3rLFenlig4ZpmJKOCSU+GArH SzxjvYCzkcZUQZp0+Xzp8At+Z40prLh8iaKVxMlx2NxSE/8+eMFaamxz9GFcLW10XYbJ4UVCMfM dTK2n0nW+drUIM5jwr86otrbyS1bjrK0PBKizjeyFtzS8fT8RQvh7CWt16loh+ZLTBdoVafwa3g /U8cwBzE/erJROwcbU8OQzBKDEEW2p70T+jjo9CJj/C0ch+13fgY514eDrM/DETfllQY1UJH4Oa q0r8XhX+SHY4LfuBNmQtyNCBMRBuvPgkYsf/IpQz/aaUJ7SPVi04ChFGC6h1/uRnLhT9Xp6l X-Received: by 2002:a17:906:a1d4:b0:c4d:31be:1f27 with SMTP id a640c23a62f3a-c513a80de57mr563735166b.9.1795371109556; Sun, 22 Nov 2026 10:11:49 -0800 (PST) Received: from Desktop.tail070c67.ts.net (p200300f24713a700f1770d5b08d979ed.dip0.t-ipconnect.de. [2003:f2:4713:a700:f177:d5b:8d9:79ed]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c513ae88143sm325931266b.32.2026.11.22.10.11.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Nov 2026 10:11:49 -0800 (PST) From: Julius Bairaktaris To: Jeff Johnson Cc: linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, linux-kernel@vger.kernel.org, tamizh.raja@oss.qualcomm.com, jtornosm@redhat.com, baochen.qiang@oss.qualcomm.com, rameshkumar.sundaram@oss.qualcomm.com, vasanthakumar.thiagarajan@oss.qualcomm.com, sriram.ramachandran@oss.qualcomm.com, yaojiale02@163.com, quic_pradeepc@quicinc.com, kvalo@kernel.org, sven@narfation.org, john@phrozen.org, toke@toke.dk, Christopher Griffin , Julia Lawall Subject: [PATCH ath-next v6 7/9] wifi: ath11k: charge received airtime to the station deficit Date: Sun, 22 Nov 2026 19:11:43 +0100 Message-ID: <20261122181145.1015729-8-julius@bairaktaris.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261122181145.1015729-1-julius@bairaktaris.de> References: <20261122181145.1015729-1-julius@bairaktaris.de> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" mac80211 charges received airtime to the same deficit, as AIRTIME_USE_RX is set by default, but ath11k reports none. Register each received PPDU's duration, which ath11k already adds to rx_duration, once against the PPDU's first TID, or BE when it names none. The TID comes from the PPDU end user stats TLV, which is added to the default monitor status filter. The call runs under ab->base_lock, as on the transmit side: ath11k_mac_op_sta_state() drops the station from its peer under that lock, and mac80211 frees it after that without an RCU grace period. A station uploading with DSCP CS5 moved its VI deficit in 3 of 3 runs; uploads marked BE left it unchanged in 3 of 3. Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.9.0.1-02146-QCAHKSWPL_SILICONZ-1 Signed-off-by: Julius Bairaktaris --- drivers/net/wireless/ath/ath11k/dp_rx.c | 11 +++++++++++ drivers/net/wireless/ath/ath11k/mac.c | 1 + 2 files changed, 12 insertions(+) diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless= /ath/ath11k/dp_rx.c index 777c56e416aed..1e4080caaa80d 100644 --- a/drivers/net/wireless/ath/ath11k/dp_rx.c +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c @@ -5280,6 +5280,7 @@ int ath11k_dp_rx_process_mon_status(struct ath11k_bas= e *ab, int mac_id, struct ath11k_peer *peer; struct ath11k_sta *arsta; int num_buffs_reaped =3D 0; + u8 tid; u32 rx_buf_sz; u16 log_type; struct ath11k_mon_data *pmon =3D (struct ath11k_mon_data *)&ar->dp.mon_da= ta; @@ -5347,6 +5348,16 @@ 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 + /* Charged once per PPDU with the measured duration, as on + * the transmit side, to the first TID of the PPDU; BE when + * it names none. mac80211 frees the station without a grace + * period after the peer drops it under base_lock. + */ + tid =3D ppdu_info->tid < IEEE80211_NUM_TIDS ? ppdu_info->tid : 0; + if (ppdu_info->rx_duration) + 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 diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/a= th/ath11k/mac.c index 4527ab6977d04..d17f80cbcdb5d 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -229,6 +229,7 @@ ath11k_phymodes[NUM_NL80211_BANDS][ATH11K_CHAN_WIDTH_NU= M] =3D { const struct htt_rx_ring_tlv_filter ath11k_mac_mon_status_filter_default = =3D { .rx_filter =3D HTT_RX_FILTER_TLV_FLAGS_MPDU_START | HTT_RX_FILTER_TLV_FLAGS_PPDU_END | + HTT_RX_FILTER_TLV_FLAGS_PPDU_END_USER_STATS | HTT_RX_FILTER_TLV_FLAGS_PPDU_END_STATUS_DONE, .pkt_filter_flags0 =3D HTT_RX_FP_MGMT_FILTER_FLAGS0, .pkt_filter_flags1 =3D HTT_RX_FP_MGMT_FILTER_FLAGS1, --=20 2.53.0 From nobody Tue Nov 24 11:44:06 2026 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.218.51 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795371113; b=b+/zzIKFhOXn616b+0L+5dtraxpOBJwB/XFme91um+m5KpTKO+O7daxmkbDIUaIwv19H ryp5FwC8qlGooS24aobzrml+NqnjvkqrElPs3x0elvPIuk+Tf3oKcFwBEczQBD4d400di B99ry1xDVHlG4AZ2PXgbjuVYWXDrONK/i8fsC2ZWh2yNFu+Dv2efdadQ3o9fTmyKDuO3W dXCdL4cL/0pwxRTHGksXqbEESR01EBffXKu7OpMnmPyLyERMualSj6xjpn4McjSo/n0GP bL7ihPbRaI6IOJn48gfYZVtY/7AnKvrJajZtqbdPPumBT5YnwRjCIn3LBR9PoQ975BA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795371113; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=u1Tw1aT0cYq0nfbsxqxhp0yxACH3DD8+q+sLIF8m4To=; b=LzjC8ldqYavDPvD2/4GrxEHsBHWbrr93WiFaM0DjsnPHsmOXcJpdkDsPuDQEAYvgzVU5 I0mPR4t2BDO6PiwFatlDVKFQCwOwGI3gcXWgYA+zhmqwjPdnfl606jUdt0DBrEVrXfpHW LgUyq40+1KiD8j9NWXGeS2DMyvNt1dv8Eytfp4XndzOO1UXIPLomm2NLnzO2qjR14oRzk yQQCU55U2u1H4DSS0xyJWvcRJKFxuhVhenTfrMRs5PDmxTKgUJOad7wSS88uqmp8wH3sd og1mzPSZ0OeR0YbskPEH27wzYy5JSAinRj/6mdfARiXqMblovkQD/JF5IOt6Wjp/hIQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=bairaktaris.de; spf=pass smtp.mailfrom=bairaktaris.de; dkim=pass header.d=bairaktaris.de header.i=@bairaktaris.de header.a=rsa-sha256 header.s=google header.b=lv9CfTdk; arc=none smtp.remote-ip=209.85.218.51 Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E94B3606A69E for ; Sun, 22 Nov 2026 18:11:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E94B3606A69E 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.a=rsa-sha256 header.s=google header.b=lv9CfTdk Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-c50aaad19fbso287354566b.0 for ; Sun, 22 Nov 2026 10:11:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bairaktaris.de; s=google; t=1795371110; x=1795975910; 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=u1Tw1aT0cYq0nfbsxqxhp0yxACH3DD8+q+sLIF8m4To=; b=lv9CfTdknAfAD6Op2Lw04B4WaOjbaDOB32iS4u4Oavu6EQi7NbsAh7Zk9ppD9B7uLM 6tPTVNuYYMOcex/kUr8D6x9/qnZdDNq5AhGi+yRkExYP4JhY7VUiBUOiVtoonh6qbSwU f03amgh3FlhBjAc0Qg2oHP8aTq9rX0CSObHr8Yez+1GOFDZUgk5XGipl5dg2A4u19Ms7 vNz1vDGpa1q6yCHtsFmsl71ZRkEiIgjKZHFzy1Z6p47/9bd8jx/el5+Iz4Cqy5zAIlKH Rm1cWF2JceICjRrdHisObhqE2A3KR4TsqjZ1EKHMaz286JsVFLSvVb296d2+CT8YAz+Y eMxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795371110; x=1795975910; 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=u1Tw1aT0cYq0nfbsxqxhp0yxACH3DD8+q+sLIF8m4To=; b=tgYAvBvwDN+3X+wELREhKGbbf+ngWPt/+wY0dXjZOLimWs4ZxSuwXysbNrp5RdCBXk SqdVkuZi2D8lFfdXuOVl1OlGNg3Ap/IReMgDiwgFpl8lkGsGVapADst1ekgSlpnGOiI8 Z7kw4JEKt7UvrRZ0vPH9RQERhyofp9xiQ6h0YixfP6P+pSgBAJsUnmUEiza1E/fmCJLf AAwdG4wSFQsKl210RdHQbe82+JtKBp8dG/LfN6Tild4j1GEjpm8gIQXRWBaBGaEv685c rtY3DKHIMU6AkEEpvub5m7kd2a20InIqB37o3YeljRn2DWkeAxV6EraDA9fUzSmFEDSR 9F0g== X-Forwarded-Encrypted: i=1; AL+hErF0PvBzBUr6O1RkuLb4nZk8kaXAS4SyUbhjc+hQ3n4cKutNtvAd8Q+wtsXe1p92IqtTekOhsM5JiEIVNCY=@vger.kernel.org X-Gm-Message-State: APuU4Z8ZKV8N4xtfFEtsd/y1/d3vHcdFKIZqKYCsR/HmtzFHCLAPOiZf V+WKFpyCTDKyZB92m5C7Np2Y+HnqZmcTt3Y3U3mWX/UiBf10wa7mWWOQjGheXVOgXg== X-Gm-Gg: AZFdTZczEYZZQCeONjOPDkB0uya5JMeiI3UH9gItclDTYrLT7weLB53YWuIrrYRIQKu 38Y9k7yNSMhHBG7MCdWow630Zxjfs8ZpzwXXaKm7yw6Hf1X23sSOMPXXW8dcy0OSIilUZXCTCJ/ EnSjpobpijsF4IF747iVug2vAXp3IHNPwvFU3bWQQAEKGhoocWWkQY6+RRTrm59Zb6qlszMWtcY F3BPupDR9CpvhTUUSYDgvx/2Z2f5KPrS1iU/aLgGc9lRQYG4TtGjIUjhCMVaMe2F6hsgs+8W4o2 ZvnQs/53OzSnOBQCZ0DJZirhoJMoIXeAnyi/BFpmZIQdkimk6/oliXiTc4PYZOsMZxkZBP2Ae1W ykHuH8RvCq7FwNCLdVZljmJeb3y4ClI0wY7yrR7is+w72ar5wla8Kn91iyZnx90V6dajXitFLdp Wfm2dyGO16NSQ8K5XJGFqUkuwaaTY5A7MK2NwgY6O/RIQkQ2Rp5ItC74yJhFsQSf5vKZd3AdJTc ikkOrNtDXHpCMnwclNNJVI0yaM5jI3Y/Es0otVGtpM46AY5bnoBimd6QTuhLdZoh/UPeN7QilmI Gdt+A/Rre6H4HkwBhIVx4bWnllQRoQFcnPNhmfu8WKxF983VdvOrOz19hSqHoCvrSY1YyQiEZ33 o3Je0E3QFCtiU0KXZJgZi+rMTsKdl1MvGDXT8E2z+nMbNpgsE1npMGbNOCGZF62EyjGXPquDxsK na6TEBv6A+vA+7otncCfzFeEupRiD58fVVHxoTbg4mE0R2PCaOFmx65AUuGqvheN++9fK+QXdmY +ciqSOliMwiuFpFC9QkAQvfUDDtUeUWWbEjy2ZwALEJlNqPVEqfooAJIK/ADUhylJRNOgfGIHb3 TuPz+cvqACSad8+R+/FyouAXdGLrRr+0VkWORwsA0kNo2zAM2afe8cxjtJgaCfKZF5rEDubp X-Received: by 2002:a17:907:73cd:b0:c40:38b5:d784 with SMTP id a640c23a62f3a-c513a614467mr750479466b.22.1795371110347; Sun, 22 Nov 2026 10:11:50 -0800 (PST) Received: from Desktop.tail070c67.ts.net (p200300f24713a700f1770d5b08d979ed.dip0.t-ipconnect.de. [2003:f2:4713:a700:f177:d5b:8d9:79ed]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c513ae88143sm325931266b.32.2026.11.22.10.11.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Nov 2026 10:11:49 -0800 (PST) From: Julius Bairaktaris To: Jeff Johnson Cc: linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, linux-kernel@vger.kernel.org, tamizh.raja@oss.qualcomm.com, jtornosm@redhat.com, baochen.qiang@oss.qualcomm.com, rameshkumar.sundaram@oss.qualcomm.com, vasanthakumar.thiagarajan@oss.qualcomm.com, sriram.ramachandran@oss.qualcomm.com, yaojiale02@163.com, quic_pradeepc@quicinc.com, kvalo@kernel.org, sven@narfation.org, john@phrozen.org, toke@toke.dk, Christopher Griffin , Julia Lawall Subject: [PATCH ath-next v6 8/9] wifi: ath11k: stop a scheduling round when the hardware is full Date: Sun, 22 Nov 2026 19:11:44 +0100 Message-ID: <20261122181145.1015729-9-julius@bairaktaris.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261122181145.1015729-1-julius@bairaktaris.de> References: <20261122181145.1015729-1-julius@bairaktaris.de> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" A round dequeues a frame from mac80211 before ath11k_dp_tx() can refuse it, and ath11k_mac_tx() then frees it. ath11k_dp_tx() returns -ENOSPC when the ring's MSDU idr, DP_TX_IDR_SIZE - 1 ids, is full and -ENOMEM when no TCL descriptor is free or a DMA mapping fails. Without airtime queue limits, as with aql_enable off, nothing keeps the frames in flight below that. Count the ids in use per ring and end the round before a dequeue when the idr or the TCL ring has no room, so a frame leaves the queue only when it can be sent. A frame refused anyway, because one sent outside a round took the last slot, still ends the round and leaves the frames behind it queued; other errors concern only the frame. A category whose round ended this way may have nothing of its own in flight, so mark it and start its round from the next tx completion on the device. Such a completion is due only while a frame is pending, so the round ends only then. It marks the category before it reads the pending counts, and tx completion reads the marks after the fully ordered decrement of its frame's count, so either the round sees no frame pending and goes on, or a completion sees the mark. With no frame pending, a refused frame is dropped and the round goes on, as before. Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.9.0.1-02146-QCAHKSWPL_SILICONZ-1 Signed-off-by: Julius Bairaktaris --- drivers/net/wireless/ath/ath11k/core.h | 2 + drivers/net/wireless/ath/ath11k/dp.c | 1 + drivers/net/wireless/ath/ath11k/dp.h | 6 ++- drivers/net/wireless/ath/ath11k/dp_tx.c | 55 +++++++++++++++++++++---- drivers/net/wireless/ath/ath11k/dp_tx.h | 1 + drivers/net/wireless/ath/ath11k/mac.c | 54 ++++++++++++++++++++---- 6 files changed, 103 insertions(+), 16 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/= ath/ath11k/core.h index 40895d276de5f..8b7bfb0cefcf2 100644 --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h @@ -713,6 +713,8 @@ struct ath11k { * other contexts that drive it */ spinlock_t txq_lock[IEEE80211_NUM_ACS]; + /* access categories whose round ended for lack of room */ + unsigned long txq_starved; =20 struct list_head arvifs; /* should never be NULL; needed for regular htt rx */ diff --git a/drivers/net/wireless/ath/ath11k/dp.c b/drivers/net/wireless/at= h/ath11k/dp.c index 3e0a6bdfa0505..615384a4bb75e 100644 --- a/drivers/net/wireless/ath/ath11k/dp.c +++ b/drivers/net/wireless/ath/ath11k/dp.c @@ -1088,6 +1088,7 @@ int ath11k_dp_alloc(struct ath11k_base *ab) =20 for (i =3D 0; i < ab->hw_params.hal_params->num_tx_rings; i++) { idr_init(&dp->tx_ring[i].txbuf_idr); + atomic_set(&dp->tx_ring[i].num_txbuf, 0); spin_lock_init(&dp->tx_ring[i].tx_idr_lock); spin_lock_init(&dp->tx_ring[i].wake_tx_lock); dp->tx_ring[i].tcl_data_ring_id =3D i; diff --git a/drivers/net/wireless/ath/ath11k/dp.h b/drivers/net/wireless/at= h/ath11k/dp.h index 6d99501aa269c..bf7439e8b37d0 100644 --- a/drivers/net/wireless/ath/ath11k/dp.h +++ b/drivers/net/wireless/ath/ath11k/dp.h @@ -85,8 +85,12 @@ struct dp_tx_ring { struct dp_srng tcl_data_ring; struct dp_srng tcl_comp_ring; struct idr txbuf_idr; - /* Protects txbuf_idr and num_pending */ + /* Protects txbuf_idr; num_txbuf changes with it and is read without */ spinlock_t tx_idr_lock; + /* MSDU ids in use, one per frame between ath11k_dp_tx() and its + * completion + */ + atomic_t num_txbuf; /* Serializes wake_tx_queue operations for this ring */ spinlock_t wake_tx_lock; struct hal_wbm_release_ring *tx_status; diff --git a/drivers/net/wireless/ath/ath11k/dp_tx.c b/drivers/net/wireless= /ath/ath11k/dp_tx.c index 0cdc0493f10d2..1c4cb98f89292 100644 --- a/drivers/net/wireless/ath/ath11k/dp_tx.c +++ b/drivers/net/wireless/ath/ath11k/dp_tx.c @@ -79,6 +79,35 @@ enum hal_encrypt_type ath11k_dp_tx_get_encrypt_type(u32 = cipher) } } =20 +/* The caller holds tx_ring->tx_idr_lock. */ +static struct sk_buff *ath11k_dp_tx_idr_remove(struct dp_tx_ring *tx_ring, + int msdu_id) +{ + struct sk_buff *msdu; + + msdu =3D idr_remove(&tx_ring->txbuf_idr, msdu_id); + if (msdu) + atomic_dec(&tx_ring->num_txbuf); + + return msdu; +} + +/** + * ath11k_dp_tx_idr_has_room() - tell whether ath11k_dp_tx() can take a fr= ame + * @tx_ring: the ring the frame would go to first + * + * ath11k_dp_tx() allocates the frame's MSDU id from the ring's idr, which + * holds DP_TX_IDR_SIZE - 1 ids and frees one when the frame completes. A + * caller that takes a frame from mac80211 only to have it refused for a f= ull + * idr loses the frame, so it checks first. + * + * Return: true if the idr has an id free. + */ +bool ath11k_dp_tx_idr_has_room(struct dp_tx_ring *tx_ring) +{ + return atomic_read(&tx_ring->num_txbuf) < DP_TX_IDR_SIZE - 1; +} + int ath11k_dp_tx(struct ath11k *ar, struct ath11k_vif *arvif, struct ath11k_sta *arsta, struct sk_buff *skb) { @@ -123,6 +152,8 @@ int ath11k_dp_tx(struct ath11k *ar, struct ath11k_vif *= arvif, spin_lock_bh(&tx_ring->tx_idr_lock); ret =3D idr_alloc(&tx_ring->txbuf_idr, skb, 0, DP_TX_IDR_SIZE - 1, GFP_ATOMIC); + if (likely(ret >=3D 0)) + atomic_inc(&tx_ring->num_txbuf); spin_unlock_bh(&tx_ring->tx_idr_lock); =20 if (unlikely(ret < 0)) { @@ -274,8 +305,8 @@ int ath11k_dp_tx(struct ath11k *ar, struct ath11k_vif *= arvif, =20 fail_remove_idr: spin_lock_bh(&tx_ring->tx_idr_lock); - idr_remove(&tx_ring->txbuf_idr, - FIELD_GET(DP_TX_DESC_ID_MSDU_ID, ti.desc_id)); + ath11k_dp_tx_idr_remove(tx_ring, + FIELD_GET(DP_TX_DESC_ID_MSDU_ID, ti.desc_id)); spin_unlock_bh(&tx_ring->tx_idr_lock); =20 if (tcl_ring_retry) @@ -294,7 +325,7 @@ static void ath11k_dp_tx_free_txbuf(struct ath11k_base = *ab, u8 mac_id, struct ath11k_skb_cb *skb_cb; =20 spin_lock(&tx_ring->tx_idr_lock); - msdu =3D idr_remove(&tx_ring->txbuf_idr, msdu_id); + msdu =3D ath11k_dp_tx_idr_remove(tx_ring, msdu_id); spin_unlock(&tx_ring->tx_idr_lock); =20 if (unlikely(!msdu)) { @@ -338,7 +369,7 @@ void ath11k_dp_tx_free_pending(struct ath11k_base *ab) =20 spin_lock_bh(&tx_ring->tx_idr_lock); idr_for_each_entry(&tx_ring->txbuf_idr, msdu, msdu_id) { - idr_remove(&tx_ring->txbuf_idr, msdu_id); + ath11k_dp_tx_idr_remove(tx_ring, msdu_id); __skb_queue_tail(&pending, msdu); } spin_unlock_bh(&tx_ring->tx_idr_lock); @@ -366,7 +397,7 @@ ath11k_dp_tx_htt_tx_complete_buf(struct ath11k_base *ab, struct ath11k_peer *peer; =20 spin_lock(&tx_ring->tx_idr_lock); - msdu =3D idr_remove(&tx_ring->txbuf_idr, ts->msdu_id); + msdu =3D ath11k_dp_tx_idr_remove(tx_ring, ts->msdu_id); spin_unlock(&tx_ring->tx_idr_lock); =20 if (unlikely(!msdu)) { @@ -795,7 +826,7 @@ void ath11k_dp_tx_completion_handler(struct ath11k_base= *ab, int ring_id) } =20 spin_lock(&tx_ring->tx_idr_lock); - msdu =3D idr_remove(&tx_ring->txbuf_idr, msdu_id); + msdu =3D ath11k_dp_tx_idr_remove(tx_ring, msdu_id); if (unlikely(!msdu)) { ath11k_warn(ab, "tx completion for unknown msdu_id %d\n", msdu_id); @@ -818,8 +849,18 @@ void ath11k_dp_tx_completion_handler(struct ath11k_bas= e *ab, int ring_id) /* A completion returns the airtime the frame was charged, which is * what an airtime-limited station in that access category is waiting * on. The arrivals that would otherwise start a round are themselves - * queued behind that limit. + * queued behind that limit. It also frees the ring space and MSDU ids + * that a round ended early on any radio is waiting on. The fully + * ordered decrement of num_tx_pending orders the read of the mark + * after the frame is counted done. */ + for (i =3D 0; i < ab->num_radios; i++) { + ar =3D ab->pdevs[i].ar; + if (unlikely(READ_ONCE(ar->txq_starved))) + push |=3D xchg(&ar->txq_starved, 0) << + (i * IEEE80211_NUM_ACS); + } + for_each_set_bit(i, &push, ab->num_radios * IEEE80211_NUM_ACS) ath11k_mac_tx_push_pending(ab->pdevs[i / IEEE80211_NUM_ACS].ar, i % IEEE80211_NUM_ACS); diff --git a/drivers/net/wireless/ath/ath11k/dp_tx.h b/drivers/net/wireless= /ath/ath11k/dp_tx.h index 9a26de411e83a..f82df5d2f6033 100644 --- a/drivers/net/wireless/ath/ath11k/dp_tx.h +++ b/drivers/net/wireless/ath/ath11k/dp_tx.h @@ -21,6 +21,7 @@ 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); +bool ath11k_dp_tx_idr_has_room(struct dp_tx_ring *tx_ring); void ath11k_dp_tx_completion_handler(struct ath11k_base *ab, int ring_id); void ath11k_dp_tx_free_pending(struct ath11k_base *ab); 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 d17f80cbcdb5d..a0f1451a8fafe 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -6519,9 +6519,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; @@ -6553,7 +6553,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) @@ -6564,6 +6564,15 @@ static void ath11k_mac_op_tx(struct ieee80211_hw *hw, 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 void ath11k_mac_drain_tx(struct ath11k *ar) @@ -10079,6 +10088,26 @@ static int ath11k_mac_op_sta_state(struct ieee8021= 1_hw *hw, return ret; } =20 +/* A round that stops for lack of room is restarted by the next tx complet= ion + * on the device, which reads the mark after counting its frame done. Mark + * first, then check that a frame is still pending, or no completion is du= e. + */ +static bool ath11k_mac_mark_txq_starved(struct ath11k *ar, u8 ac) +{ + struct ath11k_base *ab =3D ar->ab; + int i; + + set_bit(ac, &ar->txq_starved); + /* pairs with the decrement of num_tx_pending in tx completion */ + smp_mb__after_atomic(); + + for (i =3D 0; i < ab->num_radios; i++) + if (atomic_read(&ab->pdevs[i].ar->dp.num_tx_pending)) + return true; + + return false; +} + static int ath11k_mac_tx_push_txq(struct ath11k *ar, struct ieee80211_txq = *txq) { struct ieee80211_tx_control control =3D { @@ -10090,6 +10119,7 @@ static int ath11k_mac_tx_push_txq(struct ath11k *ar= , struct ieee80211_txq *txq) struct sk_buff *skb; u32 ring_selector; int num_free; + int ret; u8 ring_id; =20 ring_selector =3D ar->ab->hw_params.hw_ops->get_ring_selector(txq->ac); @@ -10099,7 +10129,9 @@ static int ath11k_mac_tx_push_txq(struct ath11k *ar= , struct ieee80211_txq *txq) =20 /* ieee80211_tx_dequeue() applies the airtime queue limit, so a * selection ends where that limit binds or the queue empties. A full - * TCL ring ends the whole round. + * TCL ring or MSDU idr ends the whole round before a frame is taken + * from the queue, and so does a frame the hardware refuses anyway, + * as long as a frame in flight will restart it. */ while (1) { if (unlikely(test_bit(ATH11K_FLAG_CRASH_FLUSH, @@ -10112,9 +10144,11 @@ static int ath11k_mac_tx_push_txq(struct ath11k *a= r, struct ieee80211_txq *txq) num_free =3D ath11k_hal_srng_src_num_free(ar->ab, tcl_ring, true); spin_unlock_bh(&tcl_ring->lock); =20 - if (num_free =3D=3D 0) { + if (num_free =3D=3D 0 || !ath11k_dp_tx_idr_has_room(tx_ring)) { spin_unlock_bh(&tx_ring->wake_tx_lock); - return -ENOSPC; + if (ath11k_mac_mark_txq_starved(ar, txq->ac)) + return -ENOSPC; + continue; } =20 skb =3D ieee80211_tx_dequeue(hw, txq); @@ -10123,9 +10157,13 @@ static int ath11k_mac_tx_push_txq(struct ath11k *a= r, struct ieee80211_txq *txq) break; } =20 - ath11k_mac_op_tx(hw, &control, skb); + ret =3D ath11k_mac_tx(hw, &control, skb); =20 spin_unlock_bh(&tx_ring->wake_tx_lock); + + if (unlikely(ret =3D=3D -ENOSPC || ret =3D=3D -ENOMEM) && + ath11k_mac_mark_txq_starved(ar, txq->ac)) + return ret; } =20 return 0; --=20 2.53.0 From nobody Tue Nov 24 11:44:06 2026 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.218.43 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795371113; b=4sTgX3uWBgs5D9geVsoA9rAoeOsLXA6JmCunM8xgEVPeiPZC/Uz1zqGQiIJH0/HYXl9F 7u2OPxCZjI9Y/ogeugzOVCojalX4bItAK6dsbIOn66UdoUx5cnh8Q10Zpckw6pa7AHfYR NIgc05wj+gONyY10AtMg6O9zJV+2tkA312tGG0+aSkdnk7PaRUGkgzpaPdh8lSQzaJQdH TktQTqLhcbQvkKSEN6f1wKWTT2dxo5qpn7OKwM/De6E+CuAWQwdC5RsiPYX5l829BhPBh miqnGMSCWDuaK3UMadR0T+unp9fuz6/lrhoAC7d/FglHCUcjitSyQ80xEyt3167MZ5w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795371113; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=nXaqa51VcSPJXED3QUfcyRH7/CS/duyW16m/AG0rVAE=; b=DCQpMqOzGWqmqnBmxuQGJdAlV+1A1isbSVeE2QBue8JAwkBhKt3Gj+e0Ymo2KEVwbjFB 6NF+xvYHwcU5MZy/RqRKEqa1IO9oKHSsRmb5BpL+d+eBmUFWJNhTjhi2brnJ8zhADsOzn UiwyXPUD/1BslQ9kMBv1C/YKgQdg/6TQpGoazcvpxzH1VbjZi+4b09EaN+bIZmUxZ+/L4 JjnvMeYWSGt47cLEvuF98kXMtYZgfmg5xf9UWzGiLfBbG35n/+Bv8rfcOMGusOU4p4Fdn 0bPJGs1s2+Vyy7XEhF7GKQPpvZO0D3R4iG2EDcQke/5nYotvw/k/iHOaqKuGLi6K8Xw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=bairaktaris.de; spf=pass smtp.mailfrom=bairaktaris.de; dkim=pass header.d=bairaktaris.de header.i=@bairaktaris.de header.a=rsa-sha256 header.s=google header.b=SuKdxpk8; arc=none smtp.remote-ip=209.85.218.43 Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9C62860A380B for ; Sun, 22 Nov 2026 18:11:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9C62860A380B 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.a=rsa-sha256 header.s=google header.b=SuKdxpk8 Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-c511cdd5a82so288686066b.3 for ; Sun, 22 Nov 2026 10:11:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bairaktaris.de; s=google; t=1795371111; x=1795975911; 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=nXaqa51VcSPJXED3QUfcyRH7/CS/duyW16m/AG0rVAE=; b=SuKdxpk8iNU8lt/p8Fs3RXd65JfVjS9b9Ti2KNsZAgMFiraZjOhStI0HYWR78WY5Kn mgQ85g3qhL2o4D7yiSF++ZEpx8oL9Wk6c8luhaJOhMvQlCzyllDWhnQp/miTTVtgXYSn J7T280wsKtXhlet3pI1okGsYUcYmY0SGU73lcdMglcCFhHnOhu2K7aQWsyt56k7YndCh lk5YQgEqytem4CTCtZxRao0TI35myyOj7jqNV+n96YS7HUtRVBC1P+3GohDfBpunANX6 65c6Vsu4gIJsCZTMuoR5AR7SBOUfvqstUTfW6Bng9LfZh+XmTy7uCdc27fgjscHq9ar3 50kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795371111; x=1795975911; 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=nXaqa51VcSPJXED3QUfcyRH7/CS/duyW16m/AG0rVAE=; b=QSRVg66pFr5aduwBQu9oV7yHMlesiSMgknSfosogWLa+486rWg2v5h0nUZ0/HRsP4A cAiBU1boyvf7PJ7Fv5KahoZI5jmn5fq9c1fpeDXdTr0YCeEnqKKB94wGaFjOtH5c5k8/ GCKg02dKExbx96zXKrr3ANc8e4LdxkukhCHncG8VmoxHNmWKAGwZsdCzV5Dr2EAOQgOF FcaIVBwBepaFDeslfYBP6bhxuLlXh1Arh1ElX0cEzTT2AHN7eOQHG9j2DDgVE0OdT1j4 21a+ut/LUGIayRT6vs4jIBP1STuajTTd/QLTxM3H9KmUyE5lpsJ/6kgLTjCcB279V6Ou 2I0g== X-Forwarded-Encrypted: i=1; AL+hErF9B8q5FrWIOkQ/8Aj8ximcRWYJtVBCxb6xVFF7W5bsBSkv5BO4RwTeRw9k3vLrzoKfMgaAvrKbnm+bmDU=@vger.kernel.org X-Gm-Message-State: APuU4Z8PipI7+XmQshdovBLU55Icy7ZoczW1QrP9hmPuxmvNIn45pdvM G7tnpuZAYsh90s/2EklGfh8yWMRwGRk0xtdH16lzBDKdki0r+rjNZ6Jw5h9rla3rXQ== X-Gm-Gg: AZFdTZe0iEAtlQf+wQmx46iLiSd/nwn62A1U/GBVne3+MiFTBFbbu6LNFYbkgJCEdr1 Yr72dJET++1+RRMr83WUip4qnUvsIu8r55rOcK66xX0j5PBfx12MVNtiISWFJqxD0JfYdOlSJjq I4q+PEoTPw1GjYMfO59+PwARVCMwyz0dyDTkihvhZ3OJZsewhFoeP8d5m7mqAbtBNoimwVVnyXK 2O9fuOhpoGmTfjnW8ZOSWl8ITYXOS4KWzqxEgSPmJxeQJD+PlB4vrW9bfHWqis8WjywZ2j4dvg4 HSbg5h2IvVnZ3oM6xXmF6doaHkRvQ2QKHgKNbQryhzJEe5J+7YKhXdUWQSv8NflDsY5ZNeTTP9m FLRcPr/TYsbxIjwjOf3lC4G+gbM2tyDhkfhtG2OCrFmalDwDqRg3NHhprmCvDHqpGh7HDYOdSgD 2uNTpdl20+DEeswlm8HfuqTGQjU1/k4CIyAwxRo105TxUTRDIn42A4yjurFUL2XnlEz+6salDyt lOdfxtqj+BkhwrSv3Fs5EjelZA2HN/1JzIPM+mFFgXRVSlMS9nQChcEyhxWx+RFLNlmyGUDcjce q3KjzdsHKlS4QoId0IBurKFY3Iyg+GDkR5L4opjJviSI9LGjnf7uaApHBCVv2SiL3eeb81Eeu6H 00T7C9z629sSR4gj/w3g0fr9hlTqgHxVs1SvNJjEt19lPvwgusA+8/xWLDABAUzOg+AEhBI32UZ dZfvthFctl1ytRlClEXwNBBTVjjJAUL9rXXj4qrh0HataF1l4bsRZVbwhmxKqIve71PNYW6U3lf fYzbztfIi97mMmRiwvAg1HB3iulpQmcmDQ7rJICXfBdRl+XkIdqpROZJesMBG1nPNDx+nHc/WxS NIzeBh2u8hNNC1h2qLTcTEc8JhhYvJzOCV9ffD3OgMBzL4Oc9/P3jLA32yKjGDGANnQugRNA X-Received: by 2002:a17:906:9fd0:b0:c50:5a93:3bd7 with SMTP id a640c23a62f3a-c513a52b574mr686313966b.3.1795371111072; Sun, 22 Nov 2026 10:11:51 -0800 (PST) Received: from Desktop.tail070c67.ts.net (p200300f24713a700f1770d5b08d979ed.dip0.t-ipconnect.de. [2003:f2:4713:a700:f177:d5b:8d9:79ed]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c513ae88143sm325931266b.32.2026.11.22.10.11.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Nov 2026 10:11:50 -0800 (PST) From: Julius Bairaktaris To: Jeff Johnson Cc: linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, linux-kernel@vger.kernel.org, tamizh.raja@oss.qualcomm.com, jtornosm@redhat.com, baochen.qiang@oss.qualcomm.com, rameshkumar.sundaram@oss.qualcomm.com, vasanthakumar.thiagarajan@oss.qualcomm.com, sriram.ramachandran@oss.qualcomm.com, yaojiale02@163.com, quic_pradeepc@quicinc.com, kvalo@kernel.org, sven@narfation.org, john@phrozen.org, toke@toke.dk, Christopher Griffin , Julia Lawall Subject: [PATCH ath-next v6 9/9] wifi: ath11k: budget the tx completion handler Date: Sun, 22 Nov 2026 19:11:45 +0100 Message-ID: <20261122181145.1015729-10-julius@bairaktaris.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261122181145.1015729-1-julius@bairaktaris.de> References: <20261122181145.1015729-1-julius@bairaktaris.de> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" ath11k_dp_tx_completion_handler() reaps the whole release ring, and ath11k_dp_service_srng() charges none of it against the NAPI budget, unlike the receive handlers. Since the handler now ends in a scheduling round, a full ring gets one round for all of it. Reap at most the budget per poll and return the count, so a round runs once per budget of completions; NAPI polls again at once for the rest. BE aql_txq_limit 500/1000 us, three interleaved runs per arm: both arms reach 94.4 to 94.8 Mbit/s, and the sender retransmits 4, 6 and 8 segments with this patch against 8, 644 and 296 without. Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.9.0.1-02146-QCAHKSWPL_SILICONZ-1 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 615384a4bb75e..833feb981cfc0 100644 --- a/drivers/net/wireless/ath/ath11k/dp.c +++ b/drivers/net/wireless/ath/ath11k/dp.c @@ -783,8 +783,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 1c4cb98f89292..5c3ddc8aad41b 100644 --- a/drivers/net/wireless/ath/ath11k/dp_tx.c +++ b/drivers/net/wireless/ath/ath11k/dp_tx.c @@ -765,7 +765,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; @@ -775,6 +776,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; @@ -803,10 +805,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]; @@ -864,6 +869,8 @@ void ath11k_dp_tx_completion_handler(struct ath11k_base= *ab, int ring_id) for_each_set_bit(i, &push, ab->num_radios * IEEE80211_NUM_ACS) ath11k_mac_tx_push_pending(ab->pdevs[i / IEEE80211_NUM_ACS].ar, i % IEEE80211_NUM_ACS); + + 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 f82df5d2f6033..760251c68b933 100644 --- a/drivers/net/wireless/ath/ath11k/dp_tx.h +++ b/drivers/net/wireless/ath/ath11k/dp_tx.h @@ -22,7 +22,8 @@ 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); bool ath11k_dp_tx_idr_has_room(struct dp_tx_ring *tx_ring); -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); void ath11k_dp_tx_free_pending(struct ath11k_base *ab); int ath11k_dp_tx_send_reo_cmd(struct ath11k_base *ab, struct dp_rx_tid *rx= _tid, enum hal_reo_cmd_type type, --=20 2.53.0