From nobody Mon Sep 28 10:00:08 2026 Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C6D3A397E96 for ; Mon, 24 Aug 2026 07:42:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787557375; cv=none; b=WWGDxXDM/nzYM1huyblnGrXeeHtbxxBxWzbxtdhtGQZMTDamY9X2Yia9IZOZWKakA5LwCnCPYuXu2pHj0azralW2r8Bde2dw7jh0dgFJV7ZzveIUEAfh1FoyX9b1KwzfBs7rRwy6kQAnpyhe0K+QMqjEmLHtR92HtN94bdFe+hY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787557375; c=relaxed/simple; bh=Bn92nLSylgxoZ9U5cHwMOT9XUKCNXy4PBAAK+jFbDKM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DXLNjZCDSzfbvwUkxtb7VypvFZ7RDpzFt//Ljz4+qrIRL5RDwXX7o/5Qt4oDRgHtDQvnk5MWRltilILHwWdOdACV2sYX+BdDTjmXsCp5nawuQYnsfUqSPDyp7D8XphyfYTvU6u2Pn6mAtl7Qz7paoA+KsjlpugtQG4/s5ZGDQQI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bairaktaris.de; spf=pass smtp.mailfrom=bairaktaris.de; dkim=pass (2048-bit key) header.d=bairaktaris.de header.i=@bairaktaris.de header.b=ZF/2i25b; arc=none smtp.client-ip=209.85.218.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bairaktaris.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bairaktaris.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bairaktaris.de header.i=@bairaktaris.de header.b="ZF/2i25b" Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-c1712a04ddaso531053566b.2 for ; Mon, 24 Aug 2026 00:42:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bairaktaris.de; s=google; t=1787557372; x=1788162172; 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=OEvSzrV5rFR5uHelmOPkOPAfb0Dsg+m2IDvGU2X7KdA=; b=ZF/2i25bqw6D5DWLjh77Uk7JFQ5W15QGXmeNFIl5qwrXx/43BYudHlmGBRcz5qqt1F oGYwspzrCMxI6vxMPb1mon2P3xzAnju/9+aDsM8a3D/gCrmi+w5fTbXQ5YFu+dw6YtbR P24RqSupaY7SZzHeV9a0Ur2Sga6zEdl3JBgIwhH8RBVj/sBs+orwdx6CSVFsaTPoqvXn SEgksKjgzjUEB0DFEM9u1XQdybE2//ByWX783T83tQ1qzhDRyLo6se74tQVLCFyxsR6h Azrg/oVkvARsZooiMGgXOetbCPynFvFjab9byBy7pjhWOXzcG1CZjY48d47ShGXUo94G HnQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787557372; x=1788162172; 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=OEvSzrV5rFR5uHelmOPkOPAfb0Dsg+m2IDvGU2X7KdA=; b=dB4h+/ZBZWybgZpSh0yn5A4Fo5MoYvIJQrVBKQjKAAeNz2XVqAJyRQFf3/WDqH1knK ZooXxPG0L2zhvK/0U1aAP9eAbwcLrr+eg9JlF0nuh2huZqJISA+i2bFjmSJLY++GfsT5 tk6QodnoBYQFaNGVNz97rXKHayFMk80/Lnf8c3LPaB4Sr9MG3vOMDLRR4xiQZeF4JtCw Gx1fOsS4J9hhZvj2jCs1Ly/lVne1bytJWV8zK7Y1Xzvi4xQNv3S2LZlUeECLeoJ2yw8U zfFhnGZepPHTzXtHF4Uz3Y1IC0FdiC11OwEWKHLnUrKJ0rDRD74OdTjFVCAe0dDe7RoW 7RXg== X-Forwarded-Encrypted: i=1; AHgh+RpJUZvxjKYq1pDoV/RalPE9JkiOm9EZjwStwxCnhUoqX0RdHoSeMC4vaYmyTJWYUcXzT53issahEEx49pI=@vger.kernel.org X-Gm-Message-State: AFuF++llmvjr9fwdDaTrIWsTWqa4GVCYfxoDOBuM83cdzZRoJ6xq3fZI CgoY4Vw9P1AqAs4BluTXAkNS44aSDT95hVoKsLZy/9jFBSNiVvcjD5Fk+3NxF48Jfg== X-Gm-Gg: AR+sD10DvwTbSof9RseRx5dQGdf4FhFlWNhHjOH8QjIYSLL+SUWrj5R3aJkdUeueq5m PMjqJFtmo6eAQOVMhnAEXxZFwEXwYvDdOS0Fpateu9SpDHXG4bh//PhXXPAMuARguRpacTEVvq3 JPVLp+pVifxjKRcCSUXduiEIhH6StSaO8SwaxAVIHVa8RXMX/a81N43JrDMjJIRz2tUhS2B1MeK jgU1YhZnn1m7VPiXvXVLGWnkfEjoE6+v9OB9ImloEM+LicFi9JveWY6yof0Th75ObgZWC8b7sPO F4QGNgqxihBnC6F+Em2wuI8z2TIRi3Zl/CkLd30K0s1gH86cxzCqRKZNSOSwRv5cXBnN7EbugmD LVdyAjNu7SLHlKfBoYeY/UGwSA+wiPsBzydX9EcwXj/Y1tUmx1zjSLRgfpLDl7DshMiExBwQzbI 0utJjmO+BbVm7c+0757kz2aU6Q8Uo9BigrhuqlJ/kxghGigt40m38LW11UV+TW5Slg+8kfXTQhK BjGRdz5F8OVqF8FLO1tRgKYTTyOG/taAiV86wtNhWMs9kHtKEHysKtfDjPrmj4n/kYyxoIiXTCr nfIGnkllPSXJTMhpZU2RTNcRfO5T/d+UlTkVMKRHAQnhx9jHJ3G81RvuIsvncInBCu12vgAYk1P jTslRRBkuO6z4QgUuNEoeVkRmfQIYYYkuxdqk0fVKguqVOzjyrl0Gx7UIR5QE5+dgDaC+w5oU7S rkPz5ffqtaZe4OGNoX2IX73MU4 X-Received: by 2002:a17:907:d78a:b0:c20:899:b8bc with SMTP id a640c23a62f3a-c2491c836e7mr1648797166b.6.1787557371929; Mon, 24 Aug 2026 00:42:51 -0700 (PDT) Received: from Desktop (p54affeee.dip0.t-ipconnect.de. [84.175.254.238]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c249685ef7bsm1261549266b.52.2026.08.24.00.42.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2026 00:42:51 -0700 (PDT) From: Julius Bairaktaris To: jjohnson@kernel.org Cc: linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH ath-next v2 1/9] wifi: ath11k: free tx skbs through ieee80211_free_txskb() Date: Mon, 24 Aug 2026 09:42:20 +0200 Message-ID: <20260824074228.2114579-2-julius@bairaktaris.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260824074228.2114579-1-julius@bairaktaris.de> References: <20260824074228.2114579-1-julius@bairaktaris.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" ath11k_dp_tx_free_txbuf(), reached from the HTT tx completion handler for the REINJ and INSPECT statuses, releases the frame with dev_kfree_skb_any(). Every other tx completion path in dp_tx.c hands the skb back to mac80211, and this one is the last that does not. A frame freed that way keeps whatever state mac80211 was holding for it. A data frame whose socket asked for tx status has a clone parked in local->ack_status_frames and an index allocated from an idr bounded at 8191 entries; ieee80211_free_txskb() releases both through ieee80211_report_used_skb(), and dev_kfree_skb_any() leaks them for the lifetime of the hw. Commit 29d15589f084 ("wifi: ath11k: Cleanup mac80211 references on failure during tx_complete") converted three sibling paths for exactly that reason and left this one. The leak also bounds AQL. ieee80211_free_txskb() returns the pending airtime the frame was charged, through ieee80211_report_used_skb(), and dev_kfree_skb_any() does not, so airtime charged at dequeue is never given back. local->aql_ac_pending_airtime[] rises without bound, ieee80211_txq_schedule_airtime_check() stops starting a scheduling round for that access category, and no station on the radio is served in it again. Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices") Cc: stable@vger.kernel.org Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.9.0.1-02146-QCAHKSWPL_SILICONZ-1 Assisted-by: Claude:claude-opus-5 Signed-off-by: Julius Bairaktaris --- drivers/net/wireless/ath/ath11k/dp_tx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath11k/dp_tx.c b/drivers/net/wireless= /ath/ath11k/dp_tx.c index cac970c92806..52c4a9924a31 100644 --- a/drivers/net/wireless/ath/ath11k/dp_tx.c +++ b/drivers/net/wireless/ath/ath11k/dp_tx.c @@ -305,9 +305,10 @@ static void ath11k_dp_tx_free_txbuf(struct ath11k_base= *ab, u8 mac_id, skb_cb =3D ATH11K_SKB_CB(msdu); =20 dma_unmap_single(ab->dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE); - dev_kfree_skb_any(msdu); =20 ar =3D ab->pdevs[mac_id].ar; + ieee80211_free_txskb(ar->hw, msdu); + if (atomic_dec_and_test(&ar->dp.num_tx_pending)) wake_up(&ar->dp.tx_empty_waitq); } --=20 2.53.0 From nobody Mon Sep 28 10:00:08 2026 Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B42BE33343C for ; Mon, 24 Aug 2026 07:42:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787557376; cv=none; b=f8j7QPRrHyIP5T8+0WK96Va8DXG0ZF5tle52xYLbys9Grluc5qljFJP2Qy6sRWAccPn7zjK4cEYE5Kgc0LTUNWsv40Fq+60kxdpuc2r6h13Y+XfmXF7nNfWFjKxqk4KGQItOG/NIXDrRVCvfskt3bb5cBF5eVOWreIutXrfvH4E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787557376; c=relaxed/simple; bh=nsfC7er9O7ftVCg4xAeP9Kmru08PDh/fEWSlZI/yvuQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uZaS4BS3Uzk3GUO4joD5glvyv+clJB2JUXaxH4fUFyJT3/OBCsnPwSTBs6ZyUeDWXJOFpbTHdNW+AlmxbhgthpQ26ahVLOT2v3ArHy6ApHeq20iCDIvOs8ArzAA7urGXyEiPOb4lebEq6smvBzMBxffjoeCCFsfchQb8udAj6fM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bairaktaris.de; spf=pass smtp.mailfrom=bairaktaris.de; dkim=pass (2048-bit key) header.d=bairaktaris.de header.i=@bairaktaris.de header.b=lNvHnBgG; arc=none smtp.client-ip=209.85.218.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bairaktaris.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bairaktaris.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bairaktaris.de header.i=@bairaktaris.de header.b="lNvHnBgG" Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-c2055f5a993so351449566b.2 for ; Mon, 24 Aug 2026 00:42:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bairaktaris.de; s=google; t=1787557373; x=1788162173; 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=NseC193O6mLkVIeO24aPT+5wuVWeRgDqN0479cwztvs=; b=lNvHnBgGHOZ/PNl8LGImCGJ2hnWjVFZYahteV4GigqkpS3hURRCvwa5GP03oDKR3tE VE33Bt5E//N+yRKMR+ZrFw1Yr2C5ES5T5RmVfz5Usx5SC81JbeGDfsb1UduaRq9zjQda FasfKKss+EBRREauFbNu/GqpcHWMhObCeqBuPuDStirr87GfI7m3zOUiUr2BiZTYojmb 7yQ9h7dxfwf50nPGRblFEtbtH2HPT4SlcEhd4giHabox4B4/7UtsSOFnYZe/cCeHG1w/ MWpYH49kRyDSP2PT2YDdSJVZ5Vgcp/KJaMnOYxjzwqigetZp5mSUZtZFz/RG6n1mJE8U yzjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787557373; x=1788162173; 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=NseC193O6mLkVIeO24aPT+5wuVWeRgDqN0479cwztvs=; b=Sq6ZWRRvpomv4ZRJYZQtfAkvyjd6esdiA71VgWC5jDW3WIHvhycPCAfp9gF0ZCD7Tf Mt/ghRC/zFx3TvLKvm7+NLXHNBt0U2GnZJajquQ3KrWM7uGcCSFy+8SmmeI2oKw4mE/d we399SgE4g/Q8/hAKLbLnJ2L5TyW/UEz0gzFVdjv6+WRMbgUKGm8zK4C5mCSjhSJSbo8 eHkt6xV+RccsxjlcxZ/XxvvW7Nd9uMKIbKtJyp/z/bTBwVdxE3GSQCVbZWWJOKdIUkWy lPcG5SNMXJ5qlOw28s/eZ/VNpcqVlZzoFsUvYO/uQB7DrL5oGpnFMnD0N7rz8R1Im55T sFXQ== X-Forwarded-Encrypted: i=1; AHgh+RqEQZ0CMWRHqvJSzwytUqkQP6Yu0CuQHszcQ6PV4ZIhFGACuIJebecvpU9Gggen+c28kO799A/g1nGvHlQ=@vger.kernel.org X-Gm-Message-State: AFuF++nPyuZry3gKzPJARl706qkqiM9WZ42+4eDYkIM28aIbYn/UDhib g0HQJn6F5FmiRXYuRlxz0LnDsrol00Va4K283wlFD6/o2TgHKrYZ/ccOn4FOUH8tbg== X-Gm-Gg: AR+sD11fubEg0ufnLpiS7MQSY5qKsqaYvcW/JUec+xv+d+2C4MHtKIywSieFpt8xXqq gA8Vr7SVYVvQIml5qyvm82n1xO2rE7A/J9pbv2sfwp/OBqpJ9UCWR8KKd+tgWSww5ipZVt+kMO6 ytaiIYgSSp5eGsLg99d0xE4vXPI3nyXMOg6YHSrEUg+L/opyphBq12SELY0bgyjAODTm5J/ooX+ xUnwL0q1A23l20JNck8sripjGc2JL38Ccji6tVcpBeFOSAxmobtuir9UJHTOXsLmUgNoyayD42m XnhZrdT/6oaCmM8xEBIfjEb9/N8WrqmfzoAshByDSkd0vO+OPODcwEGYIQdPbUD9gMZJVrXmqbV bPmE0ALIX2oKIlfyK0XQ2zwnWTHUl3if0CK9cGCWv/ZU8RFA/sZ4rBWx8QA3P8OcrvUO9WeYE2u 23njwtl60ysqXSj6zGkJtD3H+id9k2Cc+JjLb0tnNuPMINcWAXTb6NuxC9xVADIUYFYJWxQas2M H6CgVSyLGfxk7qFLnPamiKO2Wf+epHnB4TDEdfmeN6d0SXwX3gFKMkj/2nkTDXmGxMIdByUQ+UI DLPjWJtvji2Y92vucszZyqJr2FJAgerFv9H/r09Q3Iz+Y/LsdhAEQrvlMChl9Kfb3TIQqQizUId RE975OrVDGtrhEcl2JrrW2yZ8nxaqAq4Gml34lqt7Ce061S3T7FysiUFLkTCVrclQBVBhTMkggs TAwYm8ga2Tp9zrZA== X-Received: by 2002:a17:907:3e02:b0:c21:6f8c:2335 with SMTP id a640c23a62f3a-c246a6b1745mr2800831166b.16.1787557372785; Mon, 24 Aug 2026 00:42:52 -0700 (PDT) Received: from Desktop (p54affeee.dip0.t-ipconnect.de. [84.175.254.238]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c249685ef7bsm1261549266b.52.2026.08.24.00.42.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2026 00:42:52 -0700 (PDT) From: Julius Bairaktaris To: jjohnson@kernel.org Cc: linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH ath-next v2 2/9] wifi: ath11k: enable airtime queue limits Date: Mon, 24 Aug 2026 09:42:21 +0200 Message-ID: <20260824074228.2114579-3-julius@bairaktaris.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260824074228.2114579-1-julius@bairaktaris.de> References: <20260824074228.2114579-1-julius@bairaktaris.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" ath11k does not advertise NL80211_EXT_FEATURE_AQL, and every user of AQL in mac80211 is gated on that bit: the airtime charge in ieee80211_tx_dequeue(), ieee80211_txq_airtime_check(), ieee80211_sta_update_pending_airtime(), and the per-station aql file in debugfs, which is not even created. AQL is not untuned on this driver, it is absent. That matters here more than it would elsewhere, because AQL is the only brake. ath11k uses ieee80211_handle_wake_tx_queue(), whose wake_tx_push_queue() drains a selected txq whole into the driver, and the check at the top of ieee80211_tx_dequeue() is what stops that drain. Without the feature bit nothing does, so mac80211 holds no backlog and every queued byte of a saturated download sits in the hardware TX rings, where there is no AQM and no flow separation. Measured on an IPQ8074 AP against one HE 160 MHz station at MCS 11, taken from that station's own aql file while it received 280 Mbit/s: its BE queue depth reaches 6356 us of the 12000 us default limit, and 2972 us when the limit is lowered to 500/1000 us. Without this patch the file does not exist and the limits are never consulted. The rate the estimator needs is already there: ath11k keeps a per-station rate_info in arsta->last_txrate and passes it to ieee80211_tx_status_ext(), which stores it as tx_stats.last_rate_info, and that is what ieee80211_calc_expected_tx_airtime() reads. Where no rate is known yet the estimator falls back to its 4 us floor, so a station's queue is charged the minimum until the first HTT PPDU stats arrive and the per-AC limits of 5000 and 12000 us stay loose over that window. The current code charges nothing and consults no limit at all, so this cannot behave worse. The estimate is only as fresh as arsta->last_txrate, which is updated from the HTT PPDU stats when a descriptor is evicted from ar->ppdu_stats_info, so the rate behind it can lag a rate change by up to HTT_PPDU_DESC_MAX_DEPTH PPDUs. ieee80211_sta_update_pending_airtime() returns the airtime but does not reschedule the txq, and ath11k has no completion-side push, so a queue held back by AQL is re-poked only by the next enqueue or queue wake. The bit alone brakes the queue but does not refill it: the check at the top of ieee80211_tx_dequeue() stops the drain, and nothing restarts it until the next frame arrives from the network stack. Later patches in this series give the driver a scheduling round and run it from tx completion, which is what makes a binding limit affordable. ath10k and mt76 set the same feature bit. Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.9.0.1-02146-QCAHKSWPL_SILICONZ-1 Assisted-by: Claude:claude-opus-5 Signed-off-by: Julius Bairaktaris --- drivers/net/wireless/ath/ath11k/mac.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/a= th/ath11k/mac.c index 2d55cdc4d165..38f641bbc53c 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -10592,6 +10592,7 @@ static int __ath11k_mac_register(struct ath11k *ar) ar->hw->sta_data_size =3D sizeof(struct ath11k_sta); =20 wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST); + wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_AQL); wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_STA_TX_PWR); if (test_bit(WMI_TLV_SERVICE_BSS_COLOR_OFFLOAD, ar->ab->wmi_ab.svc_map)) { --=20 2.53.0 From nobody Mon Sep 28 10:00:08 2026 Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E4B2C397E86 for ; Mon, 24 Aug 2026 07:42:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787557377; cv=none; b=nr1AaK2BKoA7TF/uSO/KWFobxPpxiSdptUY8YdlsxJckyUMzXI3860VnJYVNzTenkdWGbXn2YUXIShI5br5zGZIEgBnh+KFM1NWHXKSpN9vdEyUSOnph5AHJBJ5STWtrSMFp7jp8kfz/hw2MBGkQh22TNDSk7l/yzQ17HSGLmgQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787557377; c=relaxed/simple; bh=szRQI05HgxKaZ6DD6iGBYhm/R7wACl49f6sU49pF69Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CLKCy05GqKTEXwloDyh9vcqPXm4KJHICsdx5IZBrAa6NlnqILpp58jJpyNbWvs7e0gsrGDW7xuvxKSp3hteA51jGwXONa+8SqE53C1TZT6OciO2AYJuxLKQD9AbMn1Y36Y1tOKjww8hZyHRdOfRHCkZBdH8Zv4aJwAaAXTlKh8M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bairaktaris.de; spf=pass smtp.mailfrom=bairaktaris.de; dkim=pass (2048-bit key) header.d=bairaktaris.de header.i=@bairaktaris.de header.b=hXAEl2sh; arc=none smtp.client-ip=209.85.218.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bairaktaris.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bairaktaris.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bairaktaris.de header.i=@bairaktaris.de header.b="hXAEl2sh" Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-c15cb6f5c12so557453266b.0 for ; Mon, 24 Aug 2026 00:42:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bairaktaris.de; s=google; t=1787557374; x=1788162174; 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=RRfRf2Fgkto2eylatQTpTDlM8qkBEZ0zYa2j5Lueb1w=; b=hXAEl2shXRZ/IGAwWhqjRH36ZqZCnuElboQ2SsYbSUn48IXk9kLQpQn5caIdE4UXkJ nQr38kkVePilKI/fBW5dDiMcPTYAEvYyOIdOVydzxy5xs3VS8JzxZreWMm+VrDA9Iu/5 EUjL0n3OzdTfZ+dq+3r8DkkHf2OcBsf42oWSv8Ms5HCf/rlx7qSBoNIAWrminLs9VSEQ In5cSf+eV9kQtbgR5d8Eg/M496kuEcOO7A918uOQgRO/SfMgR7NE5jmdbgvQ8Ml5bGMQ E72ldMpAHGrp6xuwDTOV2HJ8J4P+2keK0heDZT+CO/Dkv1uNBH74DNMjhGLBucjS1ufw Lr3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787557374; x=1788162174; 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=RRfRf2Fgkto2eylatQTpTDlM8qkBEZ0zYa2j5Lueb1w=; b=jKPPsNXm0v3K+/SsBtOVunnZt6zAFCzbrKJal9UVhS6TGxlnGMZX07pQMycNmGGqAv Hvm7YULHgBa8IOpwu+LJYT1/2XeXx6zKXyS8ElhyM8T7n/ALKinshXvqjT6VD7xH7ORL /u2uw5R+t2NATtURUwk5nUC3dD0fjrI8UPcdY9me6RmgrGEoVHlRYBp4oUBkn9Aq3REe qsm7PB77joKgO09PAtgZ6GPcxDwG1vx4m0IvdRo4W2rlmVzR9ZHBLetoEqQYhAb5q875 d47vYtJP3FBNDez63W+b9EqQwB9ReAv6E/ykQ76pCcbmRvSbEQ+9kiLSlGpAQWNjGRUI rBKw== X-Forwarded-Encrypted: i=1; AHgh+RoYEtP6P/FzZ1UZ0r86BZr3aSEhTW7QVMi8NIR1UggUJp7qDAXgyMRV9jPx7nXd9Xb312nZ4lhFuw/c/ts=@vger.kernel.org X-Gm-Message-State: AFuF++mlzg819uyzPgMkYVQu8FUAZrPe3UVMk0u1cQLQ7hsIhHKvGjb1 LllgDvu8/nGHaITBmTUfTaJLmqAMuaw9dCbw5fJVm/jI+CU2uMEdmPZEKu0yxofSYw== X-Gm-Gg: AR+sD11cBWgOti06zYLWcYOW0x4Dyzu6HeyiCmRpsFt5DUjLhI7Vhx4jUu6SXBuxUdu HbJQNKquBEIFgXvuuqO1IdoClBzmbyaZWb6NQLiniTpqK8GMI+E7iC9Kn0x5T6oHY/vnr/rbzAP DYBXk50xx7NLxTGa8kBHiQ6inx7IPwxyu3Scq3ALMy+8HH3n1iegQwwfhQWbbIBhoPAwBacN0mo T4yzni1wipzcX6F6/6pCh6EMlHIkfl7bUOBUCav3vMBtIkZXztPKbtXUGaZXa30Ye1uR96LGb3V StylvXvjIY91tth+Hl+DEBM80vBr1VDS/dG890ds98G/WjEEQRNXkOKhSMdLTDD0t/yl2OY97TZ ebmZbINjHWcVPiLQd78HvvalZgswnJDKhfeEm0XMR10v2cvOiis3Nsekd1Sv4AGv6FhqtHVfKd7 usc7yvOLsHlpOBJksLXTnyyKAsTF1/EXhKbbr3LLHkIled0I9WKp86kpZHNIh8DKhGUiJ4zssOi I+eta/2jStJZLPz/Y1G9dt5P3uNwcIy92bAq0iriJ8IXDDWGjYsTdzQDpbDc9Fjxb6TwhZQb3UB vYWdIYavhF7p0k2J9rT1EDjyLp+Sx9mimNrIx0yO177m7V926kY0WQoZM9Smpqc8tgSdEMbVsQH +8mIvo+0PAvLMRunvgkfVzMtgNJ13+Oc5piMOliO6CB2DU+6hyct9+wEiONn4bzlC9k7V2IvWGm ig+PayUtuRGFBgaFfPbwNwsMR9 X-Received: by 2002:a17:906:9c93:b0:c24:6687:bf6a with SMTP id a640c23a62f3a-c2492663ee3mr1794089366b.21.1787557373753; Mon, 24 Aug 2026 00:42:53 -0700 (PDT) Received: from Desktop (p54affeee.dip0.t-ipconnect.de. [84.175.254.238]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c249685ef7bsm1261549266b.52.2026.08.24.00.42.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2026 00:42:53 -0700 (PDT) From: Julius Bairaktaris To: jjohnson@kernel.org Cc: linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH ath-next v2 3/9] wifi: ath11k: report the pending tx MSDU count in soc_dp_stats Date: Mon, 24 Aug 2026 09:42:22 +0200 Message-ID: <20260824074228.2114579-4-julius@bairaktaris.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260824074228.2114579-1-julius@bairaktaris.de> References: <20260824074228.2114579-1-julius@bairaktaris.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" ar->dp.num_tx_pending counts the MSDUs the hardware has not completed yet, and is used to wait for the transmit path to drain. It is never shown. soc_dp_stats can therefore say when the transmit path overflowed - TCL ring full, misc transmit failures - and not how deep it is at this instant. The bound those counters report against is the tx descriptor idr, DP_TX_IDR_SIZE entries per ring, which is large enough that occupancy rather than exhaustion is what characterises the path under load. Print it per radio, beside the failure counters it complements. Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.9.0.1-02146-QCAHKSWPL_SILICONZ-1 Assisted-by: Claude:claude-opus-5 Signed-off-by: Julius Bairaktaris --- drivers/net/wireless/ath/ath11k/debugfs.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/wireless/ath/ath11k/debugfs.c b/drivers/net/wirele= ss/ath/ath11k/debugfs.c index 70922612d3fb..9dc586b68136 100644 --- a/drivers/net/wireless/ath/ath11k/debugfs.c +++ b/drivers/net/wireless/ath/ath11k/debugfs.c @@ -714,6 +714,18 @@ static ssize_t ath11k_debugfs_dump_soc_dp_stats(struct= file *file, "\nMisc Transmit Failures: %d\n", atomic_read(&soc_stats->tx_err.misc_fail)); =20 + /* What the hardware still owes a completion for. The counters above say + * when the transmit path overflowed; none of them says how deep it is. + */ + len +=3D scnprintf(buf + len, size - len, "\nPending Tx MSDUs:\n"); + for (i =3D 0; i < ab->num_radios; i++) { + struct ath11k *ar =3D ab->pdevs[i].ar; + + if (ar) + len +=3D scnprintf(buf + len, size - len, "radio%d: %d\n", + i, atomic_read(&ar->dp.num_tx_pending)); + } + len +=3D ath11k_debugfs_dump_soc_ring_bp_stats(ab, buf + len, size - len); =20 if (len > size) --=20 2.53.0 From nobody Mon Sep 28 10:00:08 2026 Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 45A49399364 for ; Mon, 24 Aug 2026 07:42:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787557379; cv=none; b=uAZvDmRIK4jrVt5T3vZw+RveM1cFSshSb/Jl49fF/DuAPjfjv5bEBQKkG2evt3v0BwYSGfJ60oGeoaCH2RaSKYmHrL/Fhck5Z5knkSfDS9Y2I6ugBGjXUlFEFSPn8odBksZw8wQRwziiMwqIA2p4MxjYfblQN2qWlHq+kuSEMjk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787557379; c=relaxed/simple; bh=p31/Xvf65JeO/q8DSaJZOd8MZrV6bgHXXj3pKhmNZSQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cHg60G/DndnpG11yJHmX46B8qmsm3L+oMV8G+2E2AAFfO1OxtyYB4CkMTrXqBgL+DuKADol5CWa8Oi5fXGRUOmzBSDED4V6Oq0RFI88VlxsTCPQdimkhWv6uBLj5OUVSTThoiKqC++8HsrNCrMr7s+x9Cu8Dk5CrfVbbyvjCG3c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bairaktaris.de; spf=pass smtp.mailfrom=bairaktaris.de; dkim=pass (2048-bit key) header.d=bairaktaris.de header.i=@bairaktaris.de header.b=kv8UwLGB; arc=none smtp.client-ip=209.85.208.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bairaktaris.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bairaktaris.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bairaktaris.de header.i=@bairaktaris.de header.b="kv8UwLGB" Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-6a051904222so3786739a12.2 for ; Mon, 24 Aug 2026 00:42:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bairaktaris.de; s=google; t=1787557375; x=1788162175; 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=o6H25IhW3xS5zD2V6sWstLC40W2D2voHGreESygqwOc=; b=kv8UwLGBp27QgjjK2dNagm+hiTBDGYASNh9SGUdh9xq6HZaFYnkIsS35vGZrdxc3jK Ie7Z/n/Wq9J6mZRNgDa5H7mXwY9qK6hckiIhZsEpKrbqmoQelitbKOnIUBytoDPu9Gv4 g7zzmYGme86RJDsIFE9FCJ/4qFMjzN1qiKr6D7gv8PfykUqX53Tsm2h5HzNvcM+wgZp4 M2od4tiBdLs+o7lw/c2g28DQQhbPKIO530Z1rf1y7zkMJxv8/BbOEiRfi+pbZy3YpqTy B6Gpc1HAm5eDdg4tMR5nwx4L26s+IamRCidPkVu9T1/oraCo2iXdP49BPBSY0uN26jOh 9YGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787557375; x=1788162175; 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=o6H25IhW3xS5zD2V6sWstLC40W2D2voHGreESygqwOc=; b=b5+EG4RM79gtO2M8ImT8HxA4ct6jlGwepf2LQAxqijobRshJ5BDiq9MbDWyDVL2t8k g2u2RU0VJ2WqiLYK5/s9RyXtiDfOjEp0hFQgdaYb11iT9T+6ZUnPcvpsmZkJ00/XpUhh G4s9lN4sZCeWTlClW8bWOonvFQVeLENGL55XpS9Tl3J9vt4uHOJ+eBX2ZVC8c56SrGcO G2ZdgTpqm1Q61+mUQ3VPlZBU80f1EwZmP94XSo8wFR5xJ10wWTIKDAyMUwAU/6ycBrCG PMwqQY2KWoGj6ETvwIotD6q3OzWsu5yUqnLy65eTF1JvCy1pl7yZ18G5HcTUDPfHa878 upxQ== X-Forwarded-Encrypted: i=1; AHgh+RrcXRcijW77QuJeOqpvgWfzD0EasikvV9yoVpZUT6gB98t1AFSwNcoOmO47br5RTzJkeqARJnme270LIy0=@vger.kernel.org X-Gm-Message-State: AFuF++ktBnhorZoiWNooap8QLowWEOdUAED/nDbpYcj44rD132mwK06R N75bS3a1EkhRZlm9+ioave3Rf4/BLpzx/It11oW2WWEcCmX0AtZJ1TKc0l4+2JB6bkp8gHxUaBw WGo3VRbNx X-Gm-Gg: AR+sD13RvTpA7PJHJTuEcKuu4t8B703A/RMNCDRrv/vsA4O0fd0gUyUuPh21aNLO6jL s6rjQTkRBvlnNXdfn/CSW0Pj6kiOriPdZGlkdgFaCoe3C5yuI7QRvtqEMM0RzGvJxvf0tFLwZTL hWqT8Q8lNfdn1zXE1lyAJ7EBaxrTrKZEqEQL6B0dTPBbyO2LHQmI/iA2sLP54yzl2DhiozkMSUN ciAbtcoJgAZjHIHC+wV1zGWfuN0eBMHoLWB5dHK4s5uZ67NFOrig0vvumBIQSBQbrbo/U1FYkYI nF3xobEkgxQVqBjNhkl1RInbMwi9XB5SmNm428spYrch0PkZ4Wfmw8v2lFnGn+FTH+fmnwYLREp 23WSV4Oe8DdyFXFTt73fti4nkRk9uz89RbkBz9CfNqS9YPjZD6WZDcu+b6TjJ5XQAgcOSGyBj2j WA4itfxiRc3lWDGdYPchGZUIJdxHJiIndZwrL9dLCuNSpBRi0riH5JM7hwcf0Wdtb+x3bSuUF8r 9b8j8qojb66DAdbV6kSa1NqtGuyOmFLUNyEJUKEOmD9S4H+bUTuN94xF1eFzFYKH5hbzwIwqxJO iZKMIxUMFKhA2KGCkLkcXQfzP3uvnUSiaRSH7xzQqCiLVvbVY2r0wAKfEmisnfdUGaUWzyRdSA4 YHAuYilfgk2INU0uB0iaj+YMjUh8RAJGt7b4GUoUq4c9VZocDjo19qg+3kfpMzOhwEcetqcS9Zs KXXMKKa7u6f7smUQ== X-Received: by 2002:a17:906:3e5a:b0:c20:2165:d74f with SMTP id a640c23a62f3a-c246a6ca4f5mr2287983866b.22.1787557374842; Mon, 24 Aug 2026 00:42:54 -0700 (PDT) Received: from Desktop (p54affeee.dip0.t-ipconnect.de. [84.175.254.238]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c249685ef7bsm1261549266b.52.2026.08.24.00.42.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2026 00:42:54 -0700 (PDT) From: Julius Bairaktaris To: jjohnson@kernel.org Cc: linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH ath-next v2 4/9] wifi: ath11k: report tx airtime and enable airtime fairness Date: Mon, 24 Aug 2026 09:42:23 +0200 Message-ID: <20260824074228.2114579-5-julius@bairaktaris.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260824074228.2114579-1-julius@bairaktaris.de> References: <20260824074228.2114579-1-julius@bairaktaris.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" mac80211's airtime scheduler charges sta->airtime[ac].deficit from one place, ieee80211_sta_register_airtime(). Unlike AQL there is no estimator fallback, and ath11k never calls it, so the ATF feature bit cannot be advertised on its own: the deficit would only ever be replenished, every station would stay permanently in credit, and the DRR would be inert. The bit is not a no-op in that state either, because it also moves txq insertion to the head of the active list, which __ieee80211_schedule_txq() documents as safe only because the DRR moves a station back once its deficit goes negative. fes_duration_us arrives with every PPDU's stats and is already accumulated into arsta->tx_duration a few lines above. Register it, and set the feature bit in the same change so the two cannot be separated. The access category the airtime is charged to comes from the TID, and the ack/BA status TLV that ath11k took it from is emitted only for a PPDU that drew a response. A transmission that timed out, was filtered or was aborted names its TID only in the completion and rate TLVs, both of which already reach the driver and were read nowhere. Take the first of the three the firmware supplied; a PPDU that names none of the sixteen QoS TIDs is charged to best effort, the access category mac80211 queues a frame without a QoS TID in. Measured on an IPQ8074 AP with two stations on one radio, a 1x1 VHT client and a 2x2 HE client, both receiving at once. Before, 'iw station set airtime_weight' is refused with -EOPNOTSUPP and the per-station airtime file reads zero. After, the weight is accepted and read back, TX airtime accumulates, and the per-AC deficits move. What the deficit can do with that is bounded by how the driver hands frames to the hardware, which the following patches change; the airtime share this alone produces is reported with them rather than here. Two properties of the source are worth stating. fes_duration_us spans the frame exchange sequence, so it includes the SIFS and the responding BlockAck, time the radio spends receiving; the airtime registered is therefore larger than the airtime transmitted. And it is a per-PPDU field, so on a downlink MU PPDU each user is charged the whole sequence. No per-user duration is reported in these stats. On the firmware tested here every PPDU carried exactly one user, measured over 21051 PPDUs, so the MU case is latent rather than observed. Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.9.0.1-02146-QCAHKSWPL_SILICONZ-1 Assisted-by: Claude:claude-opus-5 Signed-off-by: Julius Bairaktaris --- drivers/net/wireless/ath/ath11k/dp_rx.c | 22 ++++++++++++++++++++++ drivers/net/wireless/ath/ath11k/mac.c | 2 ++ 2 files changed, 24 insertions(+) diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless= /ath/ath11k/dp_rx.c index 33425707c084..05fb34e70889 100644 --- a/drivers/net/wireless/ath/ath11k/dp_rx.c +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c @@ -1377,6 +1377,7 @@ ath11k_update_per_peer_tx_stats(struct ath11k *ar, u16 rate =3D 0, succ_pkts =3D 0; u32 tx_duration =3D 0; u8 tid =3D HTT_PPDU_STATS_NON_QOS_TID; + u8 airtime_tid; bool is_ampdu =3D false; =20 if (!(usr_stats->tlv_flags & BIT(HTT_PPDU_STATS_TAG_USR_RATE))) @@ -1485,6 +1486,27 @@ ath11k_update_per_peer_tx_stats(struct ath11k *ar, =20 arsta->txrate.bw =3D ath11k_mac_bw_to_mac80211_bw(bw); arsta->tx_duration +=3D tx_duration; + + /* The ack/BA status TLV is emitted only for a PPDU that drew a + * response, so a transmission that timed out, was filtered or was + * aborted names its TID only in the completion and rate TLVs. Take the + * first of the three the firmware supplied. Its non-QoS, management, + * nonpause and invalid markers all sit above the sixteen QoS TIDs, so a + * value counts only when it names one of those; a PPDU that names none + * is charged to best effort, the access category mac80211 queues a + * frame without a QoS TID in. + */ + airtime_tid =3D tid; + if (airtime_tid >=3D IEEE80211_NUM_TIDS && + usr_stats->tlv_flags & BIT(HTT_PPDU_STATS_TAG_USR_COMPLTN_COMMON)) + airtime_tid =3D usr_stats->cmpltn_cmn.tid_num; + if (airtime_tid >=3D IEEE80211_NUM_TIDS) + airtime_tid =3D user_rate->tid_num; + if (airtime_tid >=3D IEEE80211_NUM_TIDS) + airtime_tid =3D 0; + + if (tx_duration) + ieee80211_sta_register_airtime(sta, airtime_tid, tx_duration, 0); memcpy(&arsta->last_txrate, &arsta->txrate, sizeof(struct rate_info)); =20 /* PPDU stats reported for mgmt packet doesn't have valid tx bytes. diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/a= th/ath11k/mac.c index 38f641bbc53c..40a2b6d2f804 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -10593,6 +10593,8 @@ static int __ath11k_mac_register(struct ath11k *ar) =20 wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST); wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_AQL); + wiphy_ext_feature_set(ar->hw->wiphy, + NL80211_EXT_FEATURE_AIRTIME_FAIRNESS); wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_STA_TX_PWR); if (test_bit(WMI_TLV_SERVICE_BSS_COLOR_OFFLOAD, ar->ab->wmi_ab.svc_map)) { --=20 2.53.0 From nobody Mon Sep 28 10:00:08 2026 Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5CA5539A7FE for ; Mon, 24 Aug 2026 07:42:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787557380; cv=none; b=DxEafk/V+7jbnEEw5PXKxhYLYHV2SSz5gb2JVZ/88p9wQ9Bq4y9lATNdkyIWITon527aBUO2K8eVm+tR/p1sJWW0zAXaVI9mKlCt/HJAKmRTCIEcj+d45SclTgaj9oOTzmG7IYF1yUKvbea7kxDgr/vSWhVN5U/v/3WbPrpn70o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787557380; c=relaxed/simple; bh=1OODO7pfXUqpgrDJ6jtA3ZccTdhv3s/5zA69zCj9aKc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=u+X7ocLOZD8EA3a0f2XVd+SgPR4iN64SXdxGpwu2Kao+OLB3kSSgJ2zassSeCcdkeU1hx1KYLJhrB5otjPMkO9YV0NjVpdUg0dbSELP2U37vF4yZz7Prig6w6EcomXjTm7n4sf21dgo0+8NCHxf7vEERYNV17Hoe5bTKwUeVnag= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bairaktaris.de; spf=pass smtp.mailfrom=bairaktaris.de; dkim=pass (2048-bit key) header.d=bairaktaris.de header.i=@bairaktaris.de header.b=a/s95eI1; arc=none smtp.client-ip=209.85.218.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bairaktaris.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bairaktaris.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bairaktaris.de header.i=@bairaktaris.de header.b="a/s95eI1" Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-c15d111ca99so369872166b.0 for ; Mon, 24 Aug 2026 00:42:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bairaktaris.de; s=google; t=1787557376; x=1788162176; 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=0HX+XBP/q492aCWaLX86g+IhZqWVnOcY+XsmiqZR6Tw=; b=a/s95eI1DKeEQAdM0s71IjlhUZpaudaHCMyO05vbhufWIjz2ptPzIu/RW58UVBlyYZ smDGCq4r75Momx19BCjGWPL2i2umVu6RFU5wgJVprnRJ6W3SSdc6NyHo+0F7sxPQARi3 vOBhEpWttviS7ZcbSuZprMZavpI+scQ5UeZkt2oQLoKno6jXeijeBzNrr3P36HOypxPd u5XcAJJIos8jTF086uh+nf5Wh7rCdg/+I2oyW8BrZ7+f2/CI2kS/8ndKd8unWGySfLJS Bn1t9MESWbaLo93NN4IIaxF78IM8LmZ/CeisRImHvCm2hG0q1tIQb1/lOCjuoIVv98PC DCbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787557376; x=1788162176; 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=0HX+XBP/q492aCWaLX86g+IhZqWVnOcY+XsmiqZR6Tw=; b=ejJl7QJ3OzvCgiAv5fm6Iw8vUpDkpsnxcLJCoq0RtLSRvTbvT4hziUz84WO1Gb5yGq aaRxvzUoqj7tE7Pi1HSe+clvVIFIEl8x+X8ytrczdu2eIt5TO8hU0o6b+C55PxHtlIkW Q5q/KwO/FsFhsP33tBxXPEBqARoNjNIsJbD7iJXRqTAkh2XXXJ4Wc6p3I+q6ebzMWGWA E5fihZGu93Mpvt9M0YeTZEdQpakPOEP5mqx8p/OWW0hfJaTlEN8qDSTnLspHVyuAKfea ppNeIQ6DgAVfjbBQN4i8kOuiBRdueRV29Sra2csXRsuHre1x1AVjhmkG3fhB+3fWh3m9 81Fw== X-Forwarded-Encrypted: i=1; AHgh+RqoheN3O3QVz4kjKbC0fwvZwP7GY3V5nDEHjJ+EZ9sFrT4asZpYaNzDgUndNVCUa2TTh4RDmnq2FWJQzIM=@vger.kernel.org X-Gm-Message-State: AFuF++m85cKK12RjKj0xNT0FZEe+1JBzO3rQORcr81LhPVNNgSBQruvN ziODT19RMQPBpTR7pFPJ6tV4JPYu63sng9xYPJTx5tyNwGWzTP4ax/PTPquSvkjmTg== X-Gm-Gg: AR+sD128DLKxyQCa7upClATePMByGVQUTKL2b2FGqZrwcugtRyG4Xmwj23rbKTJ7Yog k5J+P0l23ui89sJW0lBATozxVN8Kjn62CDH8mWnKx/XfjpBbFCuNhrWhdX++KyMG3X43lHwqx6b lXnXn6TL2uRDoPSY3OXp/3wacvATYTYJlilDpq9PG49RK8De/hOTywhkD2CRHIfTQTsa03/FfVg rO+z80EKszCCgApQJ5oCd9Wux5aN8VA3i6U2VuhK6ZbsfJ8BjPQM/ZyrRgXVPyRP1xAmKeQTZml Wo7vqWHcG1bOLd7DprQEGxsWPhBg3SDBmIjyHZw3b+NxN+1ymxD9eNLcgb7sh7jx2bdO6p7nlMn /hYDz+fLo0oMDRFUZwGluNu73YtkTfeue7Gg54I2UlZ/IWRe9paPL91xIY7BYy+qsrKeml16N0D KzHRzYVZpxPRx76598GH7jg/05e4KkdulWfb5YMI5sd+zTXzsNzUtvBjrRTL5l89R2tPl+w/20s E3+HSTZhUYMYArWuSDgqBTjrSCXyzyHMXyxBrgiGiqUiizOMMDi5uYv0c6kHz7KU53JWYTLfwkP B+3k78UD2vrfKPf+vaYJ2fhxtRqKCLX5QsOax6jEUOrtQJcmRfzct3upJ2SYxrBv6+iD/JYiL8D eqO1g2uQhnwOh4apO0dDKizUSXeYkEubpPp53BdxpZRN3MKQo/W9kPxHRohznv6+syoV0lsp18j Ca4RBDL9l8sgAqWw== X-Received: by 2002:a17:907:948a:b0:c1f:922d:34c3 with SMTP id a640c23a62f3a-c24926a1c3dmr1664099266b.14.1787557375972; Mon, 24 Aug 2026 00:42:55 -0700 (PDT) Received: from Desktop (p54affeee.dip0.t-ipconnect.de. [84.175.254.238]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c249685ef7bsm1261549266b.52.2026.08.24.00.42.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2026 00:42:55 -0700 (PDT) From: Julius Bairaktaris To: jjohnson@kernel.org Cc: linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH ath-next v2 5/9] wifi: ath11k: schedule TXQs from the driver Date: Mon, 24 Aug 2026 09:42:24 +0200 Message-ID: <20260824074228.2114579-6-julius@bairaktaris.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260824074228.2114579-1-julius@bairaktaris.de> References: <20260824074228.2114579-1-julius@bairaktaris.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" ieee80211_handle_wake_tx_queue() has exactly one entry point, the wake_tx_queue callback, so the only event that can start a scheduling round is a frame arriving from the network stack, and every round runs under local->handle_wake_tx_queue_lock, which is shared by all four access categories of the hardware. That is the wrong shape for a driver whose only backpressure is the airtime queue limit. When ieee80211_txq_airtime_check() refuses a station, ieee80211_tx_dequeue() stops handing out frames and the station's intermediate queue keeps its backlog until the next enqueue, not until the airtime it is waiting on comes back from the hardware. Returning that airtime does not reschedule anything. Open-code the round in the driver so that a second context can drive it. The walk is the same deficit round-robin over the active TXQs of one access category that the generic handler performs, taking a per-category lock rather than the hardware-wide one, and the burst a station gets from one selection stays bounded by the airtime already in flight for it because ieee80211_tx_dequeue() applies the limit itself. ath10k and mt76 schedule their TXQs the same way. A custom .wake_tx_queue with a tx-completion driven push was proposed for ath11k once before [1]; the design was right and the measurement that justifies it is in this series. Link: https://lore.kernel.org/all/20230501130725.7171-1-quic_tamizhr@quicin= c.com/ [1] Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.9.0.1-02146-QCAHKSWPL_SILICONZ-1 Assisted-by: Claude:claude-opus-5 Signed-off-by: Julius Bairaktaris --- drivers/net/wireless/ath/ath11k/core.h | 5 +++ drivers/net/wireless/ath/ath11k/mac.c | 43 ++++++++++++++++++++++++-- 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/= ath/ath11k/core.h index a0d725923ef2..40895d276de5 100644 --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h @@ -709,6 +709,11 @@ struct ath11k { */ spinlock_t data_lock; =20 + /* serialises one scheduling round per access category against the + * other contexts that drive it + */ + spinlock_t txq_lock[IEEE80211_NUM_ACS]; + struct list_head arvifs; /* should never be NULL; needed for regular htt rx */ struct ieee80211_channel *rx_channel; diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/a= th/ath11k/mac.c index 40a2b6d2f804..e5b2a5e56a28 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -6546,6 +6546,42 @@ static void ath11k_mac_op_tx(struct ieee80211_hw *hw, } } =20 +static void ath11k_mac_tx_push_txq(struct ath11k *ar, struct ieee80211_txq= *txq) +{ + struct ieee80211_tx_control control =3D { .sta =3D txq->sta }; + struct sk_buff *skb; + + /* ieee80211_tx_dequeue() applies the airtime queue limit, so the burst + * a station gets from one selection is bounded by the airtime already + * in flight for it rather than by a frame count. + */ + while ((skb =3D ieee80211_tx_dequeue(ar->hw, txq))) + ath11k_mac_op_tx(ar->hw, &control, skb); +} + +static void ath11k_mac_schedule_txq(struct ath11k *ar, u8 ac) +{ + struct ieee80211_hw *hw =3D ar->hw; + struct ieee80211_txq *txq; + + spin_lock_bh(&ar->txq_lock[ac]); + + ieee80211_txq_schedule_start(hw, ac); + while ((txq =3D ieee80211_next_txq(hw, ac))) { + ath11k_mac_tx_push_txq(ar, txq); + ieee80211_return_txq(hw, txq, false); + } + ieee80211_txq_schedule_end(hw, ac); + + spin_unlock_bh(&ar->txq_lock[ac]); +} + +static void ath11k_mac_op_wake_tx_queue(struct ieee80211_hw *hw, + struct ieee80211_txq *txq) +{ + ath11k_mac_schedule_txq(hw->priv, txq->ac); +} + void ath11k_mac_drain_tx(struct ath11k *ar) { /* make sure rcu-protected mac80211 tx path itself is drained */ @@ -10067,7 +10103,7 @@ static int ath11k_mac_op_sta_state(struct ieee80211= _hw *hw, =20 static const struct ieee80211_ops ath11k_ops =3D { .tx =3D ath11k_mac_op_tx, - .wake_tx_queue =3D ieee80211_handle_wake_tx_queue, + .wake_tx_queue =3D ath11k_mac_op_wake_tx_queue, .start =3D ath11k_mac_op_start, .stop =3D ath11k_mac_op_stop, .reconfig_complete =3D ath11k_mac_op_reconfig_complete, @@ -10757,7 +10793,7 @@ int ath11k_mac_allocate(struct ath11k_base *ab) struct ath11k *ar; struct ath11k_pdev *pdev; int ret; - int i; + int i, j; =20 if (test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags)) return 0; @@ -10791,6 +10827,9 @@ int ath11k_mac_allocate(struct ath11k_base *ab) =20 pdev->ar =3D ar; spin_lock_init(&ar->data_lock); + + for (j =3D 0; j < IEEE80211_NUM_ACS; j++) + spin_lock_init(&ar->txq_lock[j]); INIT_LIST_HEAD(&ar->arvifs); INIT_LIST_HEAD(&ar->ppdu_stats_info); mutex_init(&ar->conf_mutex); --=20 2.53.0 From nobody Mon Sep 28 10:00:08 2026 Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D177397944 for ; Mon, 24 Aug 2026 07:42:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787557381; cv=none; b=h5ygInusSuRq5OsGPg9MCxta2S4U7d74H1gSTNdJ3IW/T8xYeT3QTiTuUIIKJelxKHSN9OC+xjRXlBv4ls+beqRoTEFOL4PG4cAJ/eYoG1KiKuAw0O2BOxQrhAmvj2DdWOrgLdhasRDxCYwRwAiCcWokuAAlEu9yhEaXnwQj0dY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787557381; c=relaxed/simple; bh=kDxyaOJu7aGpkE49+5OmKIusqkl0SXPH81m2SnPnk1A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fxRkeEOlqlMGQkq8hCiWFSoTb5Hvs7LPH6VWw1+31JEZDhfafOIqlccRTXaojcHYjqvVSGga30uYIsZi0KrPM9zjwHf79G2uHlhj6SWO+0AV11lO5E5UJ9uAHx7GeHw/DHZQceGqd1Ambxuep/pfH1kV1Vg35IlpIw1IFgAq8qA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bairaktaris.de; spf=pass smtp.mailfrom=bairaktaris.de; dkim=pass (2048-bit key) header.d=bairaktaris.de header.i=@bairaktaris.de header.b=P5cfuZcz; arc=none smtp.client-ip=209.85.218.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bairaktaris.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bairaktaris.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bairaktaris.de header.i=@bairaktaris.de header.b="P5cfuZcz" Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-c207cb16cf5so487142566b.1 for ; Mon, 24 Aug 2026 00:42:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bairaktaris.de; s=google; t=1787557378; x=1788162178; 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=Aeu9v09Dg3phc4FovHKp090dH8CPgvA80R9sY0ggepc=; b=P5cfuZcz50msO0ZrU/5nGYHuTkBP7OjPC4Q2Pe6GWbtN2DvdOHcCytVwaozwoBZiPh QStAepkaP0Vct7nRYqJjehUGh7rMDnYmOeAUDJ1gTWArOXQoL7UHWTE3cnmlwTpDZVGZ 6GZRFDZd1RaFbeMjt/aVwkg/3rJ+lPLWazBlycyAkKnKEhhIqXku+G6Hzk1JtDaOmTRi pniWdCW7iZ6UW2JOuRBqsQ9q94cVPUFPeyP93/fmEDQdqUx8IusgLQiGrXg85pxQu2U0 jxO3TS65JbwFUKgNCCk81djP6lgTksnh9CKFUQsjqVORmxJu5BUOMM5o5YC/ClkM0JhH FDWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787557378; x=1788162178; 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=Aeu9v09Dg3phc4FovHKp090dH8CPgvA80R9sY0ggepc=; b=eLXKgMg7j5MFk9vW8bhyW0BupbgjdPOaPwpz9kifNA3jJmHMEAFkLhH35A67sml7FI /pWLaYXmQ+KMA5leqWrZIXcquh1+Dt8wvXCE7h/OyEYZVIAJ51Itprs3jPNcTMzSr9Rc rkgD6z45Q1bm2HYMGjnpP1hmSq8ttYYniKKDDIYlii5CSPCg8WoLaLr4Aiqwqpukzw3p lHxs2XTjH1r+3003cgNaavP0MI1yY0bjnHkFZtXa2BrVGKoDt9vYaXbNXKcM78W5WABH hh/hAIbxs/lCkmN9m0HYOsKkAwbYF519iq6d9EPJs6k4icDPkg5s3WPgNN1rszlcAFeg sBJw== X-Forwarded-Encrypted: i=1; AHgh+RoYtzS3PELdFngyF7EQLuTB97VpZR4FOugXFvZXJOQ7b5BSEEKi+pr68dTQmvNuNt9NAePnI6t/FOe4ppM=@vger.kernel.org X-Gm-Message-State: AFuF++kvEaJpX8DQgu48z50SX8qZ/f/2FjrsfIGjZvCWzk9ip3NZ/6U3 0EYqOg4dbcTXZJ8fvFr7ypHIV1h9TksT4ympSjOFEd8uj0mSzyA3P0T/1LkHiWUFnw== X-Gm-Gg: AR+sD11S9ar1A9mBW9p8g9ujOf2epMlh+j27ffDyMrJLmTWDLB09Kk0OmEYe/eruciI o7AqKYkPfwOqQh/MIKF7vTBrqtkge5A3bWCWZB3ZdRLFCMmCFyGIY+Jgoip3Qoor9sD72iJtT39 J8LdnNxDlz3NF5rMgiTdL7mqBb1r3gKEga5CySot0ta0THWgW56SoWFztGWKFWeExwXyhvVCJJJ AuAa13NcGAvY39QvseDEBUpnNk2f+PlqaZq5H2ge8Apayh9SGkGphhcXNc5CarMljxzqg9GmoRj MMEeZ5q/3Cx5G0HzDl3/hwyhs7ub4E0kO+FeGPEbj1Bvjz0EY2bxn1mhPODu0bpOJkOO8yZa4Xj wTXbzEEfMORjw+OtSpiBPcws8URi4ii/ba36dEM6oe8q5B8Jb+snLyJ0ZiUvKnih0uJK/1sTIY/ kcWEltJP2QFBKlCIsSUzVqmhH3MtDvl5mRT5kRpo3t3rMhDqxjZPjtdJsq+cEIpwtwiJP4ysWbh k17PjgmYIKjhySUZOxwa+rJMM+iqQHzlTrYG9UoxMdEQBc7NUmp+icIltcrdCNWPJmyxhvskK/h tS45YvfhAsZh+zR4ynyG8lvY2tId8NgDZzgh+Z2RGt9q901NBA8lpLVeWzE/Pkw7eCfAm/2zqfn bktn1YYWcaZdPOZAnnttkrk10jjYiR40jET5eWU+/EW8FB1d64fseenP4IjkP6RmKjRWfzVsxLQ Czxh1YxZHxC2txcUBFozdckInC X-Received: by 2002:a17:907:6094:b0:c1f:9c3b:96a7 with SMTP id a640c23a62f3a-c246a6269d2mr2635539266b.17.1787557377479; Mon, 24 Aug 2026 00:42:57 -0700 (PDT) Received: from Desktop (p54affeee.dip0.t-ipconnect.de. [84.175.254.238]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c249685ef7bsm1261549266b.52.2026.08.24.00.42.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2026 00:42:56 -0700 (PDT) From: Julius Bairaktaris To: jjohnson@kernel.org Cc: linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH ath-next v2 6/9] wifi: ath11k: run the TXQ scheduler on tx completion Date: Mon, 24 Aug 2026 09:42:25 +0200 Message-ID: <20260824074228.2114579-7-julius@bairaktaris.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260824074228.2114579-1-julius@bairaktaris.de> References: <20260824074228.2114579-1-julius@bairaktaris.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" A station whose airtime queue limit is reached stops being served by ieee80211_tx_dequeue(), and the airtime it is waiting on is only returned when the hardware completes the frames already charged to it. ath11k starts a scheduling round from the wake_tx_queue callback and nowhere else, so once the limit binds, the backlog moves again only when the next frame arrives from the network stack. Under a saturated download the arrivals keep the round running; a flow that has just filled the intermediate queue, or one whose sender is waiting on the acknowledgements behind that queue, stalls for as long as it takes the next arrival to appear. Start a round for every radio whose completions were reaped, at the point where the airtime has been returned. The airtime queue limit then bounds a queue that is refilled as it drains, rather than one that is refilled when the network stack happens to push. Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.9.0.1-02146-QCAHKSWPL_SILICONZ-1 Assisted-by: Claude:claude-opus-5 Signed-off-by: Julius Bairaktaris --- drivers/net/wireless/ath/ath11k/dp_tx.c | 12 +++++++++++- drivers/net/wireless/ath/ath11k/mac.c | 10 ++++++++++ drivers/net/wireless/ath/ath11k/mac.h | 1 + 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath11k/dp_tx.c b/drivers/net/wireless= /ath/ath11k/dp_tx.c index 52c4a9924a31..2270b2079297 100644 --- a/drivers/net/wireless/ath/ath11k/dp_tx.c +++ b/drivers/net/wireless/ath/ath11k/dp_tx.c @@ -694,9 +694,10 @@ void ath11k_dp_tx_completion_handler(struct ath11k_bas= e *ab, int ring_id) struct sk_buff *msdu; struct hal_tx_status ts =3D {}; struct dp_tx_ring *tx_ring =3D &dp->tx_ring[ring_id]; + unsigned long push =3D 0; u32 *desc; u32 msdu_id; - u8 mac_id; + u8 mac_id, i; =20 spin_lock_bh(&status_ring->lock); =20 @@ -756,12 +757,21 @@ void ath11k_dp_tx_completion_handler(struct ath11k_ba= se *ab, int ring_id) spin_unlock(&tx_ring->tx_idr_lock); =20 ar =3D ab->pdevs[mac_id].ar; + __set_bit(mac_id, &push); =20 if (atomic_dec_and_test(&ar->dp.num_tx_pending)) wake_up(&ar->dp.tx_empty_waitq); =20 ath11k_dp_tx_complete_msdu(ar, msdu, &ts); } + + /* A completion returns the airtime the frame was charged, which is + * what an airtime-limited station is waiting on. Nothing else starts a + * scheduling round once the arrivals that would have started one are + * queued behind that limit. + */ + for_each_set_bit(i, &push, ab->num_radios) + ath11k_mac_tx_push_pending(ab->pdevs[i].ar); } =20 int ath11k_dp_tx_send_reo_cmd(struct ath11k_base *ab, struct dp_rx_tid *rx= _tid, diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/a= th/ath11k/mac.c index e5b2a5e56a28..996f421b6957 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -6582,6 +6582,16 @@ static void ath11k_mac_op_wake_tx_queue(struct ieee8= 0211_hw *hw, ath11k_mac_schedule_txq(hw->priv, txq->ac); } =20 +void ath11k_mac_tx_push_pending(struct ath11k *ar) +{ + u8 ac; + + rcu_read_lock(); + for (ac =3D 0; ac < IEEE80211_NUM_ACS; ac++) + ath11k_mac_schedule_txq(ar, ac); + rcu_read_unlock(); +} + void ath11k_mac_drain_tx(struct ath11k *ar) { /* make sure rcu-protected mac80211 tx path itself is drained */ diff --git a/drivers/net/wireless/ath/ath11k/mac.h b/drivers/net/wireless/a= th/ath11k/mac.h index 59f83c7175fd..4012155dddb6 100644 --- a/drivers/net/wireless/ath/ath11k/mac.h +++ b/drivers/net/wireless/ath/ath11k/mac.h @@ -161,6 +161,7 @@ struct ath11k *ath11k_mac_get_ar_by_vdev_id(struct ath1= 1k_base *ab, u32 vdev_id) struct ath11k *ath11k_mac_get_ar_by_pdev_id(struct ath11k_base *ab, u32 pd= ev_id); =20 void ath11k_mac_drain_tx(struct ath11k *ar); +void ath11k_mac_tx_push_pending(struct ath11k *ar); void ath11k_mac_peer_cleanup_all(struct ath11k *ar); int ath11k_mac_tx_mgmt_pending_free(int buf_id, void *skb, void *ctx); u8 ath11k_mac_bw_to_mac80211_bw(u8 bw); --=20 2.53.0 From nobody Mon Sep 28 10:00:08 2026 Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3D4E839CD10 for ; Mon, 24 Aug 2026 07:43:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787557382; cv=none; b=GCpxNhkJ6IpRGRQJcZpJ35LCca79Z4xWb999VZN/GpDizua6j0zTWrDO+0L1Vr4QChXMen/2lLSaknK1uBmT8SnR7x7/JKdwnqnBHYgvNZRtYzd6BIjtHvqc2pOfYwNK4x01D3kMAVpc3SXUKMOsVgGDa08Ocr/Lb2csNpfOhPw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787557382; c=relaxed/simple; bh=5Hn9vrXHrtMzrUC/0YhR95XQb9FD2bjJDMcnXNQ/WXc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iMbFYEv3i23iDbON/eRCW3j2bf1Vx6kzWuhFJGnZ2owWCH+Q5zZsGQYF/TItOE7snyz27cUcO3LPpaLl8yy/rMCTFLribY88w+MFmysGrKikD5NmXHAsqYsSXFOnW7MTS4LFw38M9/vDQzCNREAGe6h4P7BZNvE406+AXfzAPa4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bairaktaris.de; spf=pass smtp.mailfrom=bairaktaris.de; dkim=pass (2048-bit key) header.d=bairaktaris.de header.i=@bairaktaris.de header.b=W4iqxAP3; arc=none smtp.client-ip=209.85.208.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bairaktaris.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bairaktaris.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bairaktaris.de header.i=@bairaktaris.de header.b="W4iqxAP3" Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-6a422090b2fso4635535a12.0 for ; Mon, 24 Aug 2026 00:42:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bairaktaris.de; s=google; t=1787557378; x=1788162178; 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=b4iOAeD/vez7o1BoFsDFbdz2zh1sUHtZ1x5O3PJ3hJw=; b=W4iqxAP3sMaK4uTRfeCMpzh+PTzm3XYmW3klItknRc+YyI4tMkqMKWJ1wQBFpj1nWj 8zMUmkB/SI4gxFco8by91fXVIPNIIVsnrgE8ZuIEbmvQQELjABsjscliqCj2D1JhdGGw kR+jSgjaXx46A3WG6bZC6KA6P0dWdO8tpa/I/E9cFPbHXffBKGA38LhZHg3+9efjmMG/ rJTmKes0nt4mRmhxn76M2paOQBY1qH9on0umR9G/2ySzAfhnxHgsiwS6lchY4nrILYod 84PpDEjFQsp6qLAGo+AQgnmzGxDUUTseMgQC0op4xsHlauehTO0LQsSEiPbgTpRPq11R PHFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787557378; x=1788162178; 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=b4iOAeD/vez7o1BoFsDFbdz2zh1sUHtZ1x5O3PJ3hJw=; b=JhAHYkvtI20Gz+Whse9fGRZBNaDEzGf4i1vES2eB7s/uu/lBUMTFYs7gwOKEcb82F6 Jep5Hkca+DeRqoJgMF7qt9j+R7TkSD/Nv5tmUxuXMf5ZDUJ1kxId3cpXI/etEsVwPKLx A9uy1XgRGr4MDj5uQQCdTeaAp/xehNSpHA5RiHIngG7fWdEmNAhDrCEOF30MMlsxodKc X7tXwKkgeQO09aVoqz9rJ9/sif0m711ONQazZeWuIu8KckBnP9ULmF6dK1vlLoFzFYXP xE+/iDFY2yCTtaTCUdQCvwxFtQu+vZDoHhMan48pk7ihXACPnT0ksXmwLDwT3UAEzhAN s3ww== X-Forwarded-Encrypted: i=1; AHgh+RrPHXPi6DaJdisU3xKxZ+LLU+GndJ3yiuC/XWi0smYLa9xQYhMzzmmmoS4IE2kMukh2hZPrYiV1K1GHYhE=@vger.kernel.org X-Gm-Message-State: AFuF++kSIJPok7gTiTY8PJtGNSSfklF5cJn9mOC3kkVWUOXeDmk0Jb8N iajOthdxfrs1XWFxq6b+em0rQA3qVwyZg8cyS24d7vSsHPhGO+o+AK1Mq8Uety2iJdxaXlDcNvs AO6oY2lmG X-Gm-Gg: AR+sD122OjqzTZUsV97JfAYUDGunqFfLqDgWkXFjlKxV/rRmfNFJ/xPxl1uzkA11kNl 5PfORcm8+PNvOzIWEEwjmrxxX6GeR5sxdAuwiMOHAmQG7n0NYgmSni8W8wqAV2uLiIwjZtBkm8f ETZk59E+Zx3QKGHSxNBm3+6UqcVCNU8mH9EsPCwbuB2rW3LYqzqgxDhMkqoBjinVm+YUyVI7xuQ yuxpDe2pK15ZQRWsmPtTfmPvZvn5ADHMzRBQsHmfZXMrlv4CDbxiNR48rY9y/V45I8rGTy6KCuM //lLhW1+DyYYlOQY6CcKA+uZLJzSMzjFuBAXbIz4uqHX7lXPeDxZDyRh9zn48GjPKSlHfgt412g osQRO5QsCW5qNQjkZsaslAHSzPNnho9dubhktfN32YKsEeeecS9VJYAoUygfOM0+7lG8B+OqctL AS5EWBxWQnjbLuVg2cbEMwIEbMxGNWxBkQdTTObx8DIMT4r7FFCjlmIaKgGXU3bQiKwxEwDbTRJ 7jLLTBqysY3ZTAd9NYQQCjkK3XvESF33DlM2qYnfHX/W9BxbEojLHtSR6sBg+pvhWhBKiH1cXVr 3JnCbSRqL/DBxwywhY9MUq4sDeYVMbC9UvW8If9ZaezlOXauaI5Xj/PDTZxbZyrN0klb2Xn8tQQ 6ov3vQLUJMkrwIhFmE5M4e8PMX/s/ULlfWcyYmz1IZ5fwzIMaQFzvYhKzsOU472i3diK5iX3uYo 93MWO8o2djDpxJ4g== X-Received: by 2002:a17:907:3d56:b0:c1f:e9d6:2a6f with SMTP id a640c23a62f3a-c2469f9991dmr2918228666b.0.1787557378200; Mon, 24 Aug 2026 00:42:58 -0700 (PDT) Received: from Desktop (p54affeee.dip0.t-ipconnect.de. [84.175.254.238]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c249685ef7bsm1261549266b.52.2026.08.24.00.42.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2026 00:42:57 -0700 (PDT) From: Julius Bairaktaris To: jjohnson@kernel.org Cc: linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH ath-next v2 7/9] wifi: ath11k: charge received airtime to the station deficit Date: Mon, 24 Aug 2026 09:42:26 +0200 Message-ID: <20260824074228.2114579-8-julius@bairaktaris.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260824074228.2114579-1-julius@bairaktaris.de> References: <20260824074228.2114579-1-julius@bairaktaris.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" mac80211's airtime scheduler is configured to account both directions: local->airtime_flags is AIRTIME_USE_TX | AIRTIME_USE_RX, and ieee80211_sta_register_airtime() adds the received airtime to the same deficit the transmit side subtracts from. ath11k passes zero for it, so an access point serving a station that mostly uploads charges that station nothing for the medium it occupies, and the deficit that decides whose queue is served next describes half the traffic. Register the duration the hardware reports for each received PPDU. It arrives in the RXPCU PPDU end TLV on the monitor status ring, which is subscribed for every radio, and ath11k already accumulates it as the station's rx_duration. Charging it once per PPDU matches what the transmit side registers, whereas an estimate rebuilt per MSDU counts the preamble and the interframe space once for every subframe of an aggregate: measured against one HE station, the per-MSDU estimate from ieee80211_calc_rx_airtime() reports 16.9 s of receive airtime where the hardware measured 6.8 s. A PPDU that reports no TID is charged to BE, matching what the transmit side does with a frame carrying no QoS control field; the value cannot be masked into range because ppdu_info->tid is ffs() of the TID bitmap less one, so a PPDU reporting none leaves 65535 and masking would select VO. A PPDU from a peer with no station entry is not charged to anyone. Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.9.0.1-02146-QCAHKSWPL_SILICONZ-1 Assisted-by: Claude:claude-opus-5 Signed-off-by: Julius Bairaktaris --- drivers/net/wireless/ath/ath11k/dp_rx.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless= /ath/ath11k/dp_rx.c index 05fb34e70889..d0da72b04aec 100644 --- a/drivers/net/wireless/ath/ath11k/dp_rx.c +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c @@ -5343,6 +5343,26 @@ int ath11k_dp_rx_process_mon_status(struct ath11k_ba= se *ab, int mac_id, arsta =3D ath11k_sta_to_arsta(peer->sta); ath11k_dp_rx_update_peer_stats(arsta, ppdu_info); =20 + /* The airtime a station spends transmitting is airtime it takes + * from the others, so the fairness deficit is charged for it as + * well. This is the duration the hardware measured for the + * whole PPDU, which is what the transmit side registers too. + * + * ppdu_info->tid is ffs() of the TID bitmap less one, so a PPDU + * that reports no TID leaves it at 65535; charge that airtime to + * the same access category the transmit side gives a frame with + * no QoS TID. + */ + if (ppdu_info->rx_duration) { + u8 tid =3D 0; + + if (ppdu_info->tid < IEEE80211_NUM_TIDS) + tid =3D ppdu_info->tid; + + ieee80211_sta_register_airtime(peer->sta, tid, 0, + ppdu_info->rx_duration); + } + if (ath11k_debugfs_is_pktlog_peer_valid(ar, peer->addr)) trace_ath11k_htt_rxdesc(ar, skb->data, log_type, rx_buf_sz); =20 --=20 2.53.0 From nobody Mon Sep 28 10:00:08 2026 Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0BB6239DBFA for ; Mon, 24 Aug 2026 07:43:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787557383; cv=none; b=mKutLAym9n5DtdKghN1or2E+qPZn48bcQ4FN0BIz3Y5/RtN2nbLMBG1bk40b+HhjoPudLQqDHPiozy8CfOrIsiccb0rGCdjMkjE8TTm5NvlDCn3aNW7zGsm3mAKtAAB6F/9qOLsJbA6YwnkU/l4b176ojIbNC4pvS3rhNz0Emb8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787557383; c=relaxed/simple; bh=mWfayRCA0S5NuSm5G9JW/1Jerbcn53Tnz8gP/ayFSTY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=q1ho/K0TPGnT73vQOptFCkpdQeuIHcmuONym1acIR8AQbK0TFF4qm5dtMv4C+iile2fOeFv8y+aF+ClEVSYtSjKOZ3nCF7Z4OJQaOz1LM7iINpMQsySEHcS1Ogk9BbUGNFJmgjLQu9ucybDZScb3qakOlYezw8qx7XdJpkl8Hks= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bairaktaris.de; spf=pass smtp.mailfrom=bairaktaris.de; dkim=pass (2048-bit key) header.d=bairaktaris.de header.i=@bairaktaris.de header.b=kZcQyDK0; arc=none smtp.client-ip=209.85.218.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bairaktaris.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bairaktaris.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bairaktaris.de header.i=@bairaktaris.de header.b="kZcQyDK0" Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-c15f020a223so457354666b.1 for ; Mon, 24 Aug 2026 00:43:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bairaktaris.de; s=google; t=1787557379; x=1788162179; 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=IUe2piPfROCuIddmZ/ae/9op4qLIu+jbzjbUhLZABGU=; b=kZcQyDK0Qqp0anIUDKGK17xRdsnfhHr6ZRw25UXivBSV0Sbqy5Byzx62cZehkZoXmV r9t2rs3cZeW09m5cMbDIETdNtehCtdKhIVBvZkr1SlKVC1ZcqMrO/SNkTJaGEbFnmtWT H1y016/yxNQ6gin0ybduxcEeEGRrI+e47uYAhJ7i0PHSynu1zc48CzBdd8i6Lujuj4hn VsI75aTMM97q6EuEkEMPY7iIjwwrWnbYj8DBND/nB/gebZvDVo6hWyn/UAMQDXELjWn1 wzQxpP7wDyZCYwveMvgYLEeqlP4nJHxHkbb8L+/m3HQrmySmWwDpRY+F0bxJErlXmHHV tTDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787557379; x=1788162179; 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=IUe2piPfROCuIddmZ/ae/9op4qLIu+jbzjbUhLZABGU=; b=ZIRmvyycpFd1tMC3LrtEVNqhVFGKyD92L4PeusGYH3B4djg3+oHKK9e5x4cHOTP6+i n4H/QpPjHdYwwm4W7b03OzYMvAt9jx5TXxBbtx1QSpG+N6mBYQ1d6lA+RvJ6HegieJW4 oeElZeSVhzhAtUTDNJWgsUhP/rE6ysOF3rN5ljlQ2uj7BxcEL//Bvuy6i/BEuTsFI7ZP Pcrd/ifjiihzsl0Kn0QAml9upsn2VjJiIuWAHdpoeQJgRMkn9je3TLcmE+N+/hHP/Gdu 4JmZk+GchSg8ygwr2+lw1q3JVL8tmWOy4A3HaqujMtoVTCi33MOIYe4x1JaZOfS50eqR R7ug== X-Forwarded-Encrypted: i=1; AHgh+RrcJHXLhdjXhX5V+VhVUB/roLT7vev3Ay32h3fWKx83qaZo+x9l8d0JeFZLt2DtSpKP604JJjyo1Ttf8Fs=@vger.kernel.org X-Gm-Message-State: AFuF++mg9pGiOfOHXlldtMgWPytMbfG4rX6QMoNtbam2A0vdo+6vzvt8 T/0ix0cHOb+Rhd6ciTB8xbfF929GE7WulOPuYdhmwqj6WikC0FLYjQgjS2dzTmbvbw== X-Gm-Gg: AR+sD10WCdV6nw/XW24PxPtwLFW35/Xf6hu8CLy15Ti8L6Tbyb7jWuXPBKBTKkqeM7J UZwgtaHgQokwnP2c3usjause9aygH7Dlr/Awe84F/d6Om/WE/e+vi8d63F1J95VjKC1L28BKkq0 J8HAPBel5kkAu/5V696Q4SWinJdk5t4aqbZOrnWncwLiZX560mThuB9hfjwd2WXFClPSUgHnht2 /TxLJ/h9aHPQE8EdVMSOea9Ym5cjv51rfoks5Ld9+U+sQglfJMoF9nIv3ci+CztAAVsMMYFpEhX DovI1x02Oc/VSGjMKo82F8BpuEvMU4OboVQ4hjhNlqr8fhv7V7x2946/6Kn78DaiT5U03ch53Do cpUfXIdzaaT2f4lru7vs34T6gWFe3hXTfmnZ5sGG0WU/YWMA7LdUD+0W+k69O9GBF+53XRJ2g6Z mit/7WLQlJERPAeXJXR4OmMBxHNq9BCBXFJo8sjRCrkrto+5U0Pn1p67Apk92VisNkV3nVRO+A2 ftWXDN4gO+61RNY9soHtx+uNO1sGoxwCj8UISf89917CA03EEIJ/zBpZ1jtMVTMT45K5zA3Kpnv /vVabntYNfK4C4w4fbuDq5v0Fqv9NpcW1YxDf4I44xyeFQiGwkJVDVRaKtErS8fvFIssE3Exo0P +jNkjOimqO9DoWquRsHTmlvOfMzRQuY9Qhh1i7yvgPZhGHD4cCzuLn+wTetGDm9Nhc39bkGrJ7H TP+s9Tw4y7C1rezQ== X-Received: by 2002:a17:906:4fc6:b0:c08:417e:3696 with SMTP id a640c23a62f3a-c24d922ff39mr61778966b.20.1787557379061; Mon, 24 Aug 2026 00:42:59 -0700 (PDT) Received: from Desktop (p54affeee.dip0.t-ipconnect.de. [84.175.254.238]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c249685ef7bsm1261549266b.52.2026.08.24.00.42.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2026 00:42:58 -0700 (PDT) From: Julius Bairaktaris To: jjohnson@kernel.org Cc: linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH ath-next v2 8/9] wifi: ath11k: stop a scheduling round when the hardware refuses a frame Date: Mon, 24 Aug 2026 09:42:27 +0200 Message-ID: <20260824074228.2114579-9-julius@bairaktaris.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260824074228.2114579-1-julius@bairaktaris.de> References: <20260824074228.2114579-1-julius@bairaktaris.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" ath11k_dp_tx() returns -ENOSPC when the MSDU idr is exhausted and -ENOMEM when no TCL descriptor is free on any ring, and the caller answers both by freeing the frame. Inside a scheduling round that is a loop: the next iteration pulls the next frame out of the same flow queue and drops that one too, so a transient shortage costs the head of an FQ-CoDel queue rather than the tail of a hardware one, and the frames it discards are the ones the queue had already selected as most deserving of the medium. Return the error from the transmit path and end the round on it. The round-robin over the remaining stations stops as well, since a shortage that reaches this point is not specific to the station being served. ath11k_dp_tx() also rejects a frame the hardware can never accept, with -EINVAL or -EOPNOTSUPP; those describe the frame and not the ring, so the round continues past them. ath10k and mt76 end a round the same way when the hardware has no room. Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.9.0.1-02146-QCAHKSWPL_SILICONZ-1 Assisted-by: Claude:claude-opus-5 Signed-off-by: Julius Bairaktaris --- drivers/net/wireless/ath/ath11k/mac.c | 34 ++++++++++++++++++++------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/a= th/ath11k/mac.c index 996f421b6957..eb420fa0fd68 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -6499,9 +6499,9 @@ static int ath11k_mac_mgmt_tx(struct ath11k *ar, stru= ct sk_buff *skb, return 0; } =20 -static void ath11k_mac_op_tx(struct ieee80211_hw *hw, - struct ieee80211_tx_control *control, - struct sk_buff *skb) +static int ath11k_mac_tx(struct ieee80211_hw *hw, + struct ieee80211_tx_control *control, + struct sk_buff *skb) { struct ath11k_skb_cb *skb_cb =3D ATH11K_SKB_CB(skb); struct ath11k *ar =3D hw->priv; @@ -6533,7 +6533,7 @@ static void ath11k_mac_op_tx(struct ieee80211_hw *hw, ret); ieee80211_free_txskb(ar->hw, skb); } - return; + return ret; } =20 if (control->sta) @@ -6544,19 +6544,34 @@ static void ath11k_mac_op_tx(struct ieee80211_hw *h= w, ath11k_warn(ar->ab, "failed to transmit frame %d\n", ret); ieee80211_free_txskb(ar->hw, skb); } + + return ret; +} + +static void ath11k_mac_op_tx(struct ieee80211_hw *hw, + struct ieee80211_tx_control *control, + struct sk_buff *skb) +{ + ath11k_mac_tx(hw, control, skb); } =20 -static void ath11k_mac_tx_push_txq(struct ath11k *ar, struct ieee80211_txq= *txq) +static int ath11k_mac_tx_push_txq(struct ath11k *ar, struct ieee80211_txq = *txq) { struct ieee80211_tx_control control =3D { .sta =3D txq->sta }; struct sk_buff *skb; + int ret; =20 /* ieee80211_tx_dequeue() applies the airtime queue limit, so the burst * a station gets from one selection is bounded by the airtime already * in flight for it rather than by a frame count. */ - while ((skb =3D ieee80211_tx_dequeue(ar->hw, txq))) - ath11k_mac_op_tx(ar->hw, &control, skb); + while ((skb =3D ieee80211_tx_dequeue(ar->hw, txq))) { + ret =3D ath11k_mac_tx(ar->hw, &control, skb); + if (unlikely(ret =3D=3D -ENOSPC || ret =3D=3D -ENOMEM)) + return ret; + } + + return 0; } =20 static void ath11k_mac_schedule_txq(struct ath11k *ar, u8 ac) @@ -6568,8 +6583,11 @@ static void ath11k_mac_schedule_txq(struct ath11k *a= r, u8 ac) =20 ieee80211_txq_schedule_start(hw, ac); while ((txq =3D ieee80211_next_txq(hw, ac))) { - ath11k_mac_tx_push_txq(ar, txq); + int ret =3D ath11k_mac_tx_push_txq(ar, txq); + ieee80211_return_txq(hw, txq, false); + if (unlikely(ret)) + break; } ieee80211_txq_schedule_end(hw, ac); =20 --=20 2.53.0 From nobody Mon Sep 28 10:00:08 2026 Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D4890399377 for ; Mon, 24 Aug 2026 07:43:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787557384; cv=none; b=J7OtthNZLZvW+HDBMDdcIHrGN18R+CesmZcfw1QvXeSqPIEvXkxMEHIAgHnw3piXTbLtP033xI1JVokbnv1V7y+z3lfvfPEhBv1T4Lb2rXw5iYG8+l0ktBlG1xLNNuVzzUgLao9HdNa854se5eMgAivO4K4sghN7zG9jMP2M3vI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787557384; c=relaxed/simple; bh=jBU+6dFYFt1wbcIcVm2pNiBgqWCTHfH0WI0xzF32+/o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=I2rOY/Vdqxx3uyFuIaY2gE+MrsWtAzMgyI1BKBM5c1hUykSVQF8VSKmYgukKFhyyh5yjaXnEOIUrjPrz8rpUQ3/aW56ZS5vg5qyre8hCGdfZauuaEvlx99JpWDryR3JJ9gq1MDT5EJbebYaRx22vHnSwJN2ze6R5Fi+VcX/E3Iw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bairaktaris.de; spf=pass smtp.mailfrom=bairaktaris.de; dkim=pass (2048-bit key) header.d=bairaktaris.de header.i=@bairaktaris.de header.b=pUXRvOHt; arc=none smtp.client-ip=209.85.218.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bairaktaris.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bairaktaris.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bairaktaris.de header.i=@bairaktaris.de header.b="pUXRvOHt" Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-c15ba3a2b4bso440229666b.1 for ; Mon, 24 Aug 2026 00:43:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bairaktaris.de; s=google; t=1787557380; x=1788162180; 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=TAcQKsiHHrhl5U4tNXvyThYZ1gGnGcacUCSiyofhb0k=; b=pUXRvOHtcSA/5EKH3CHYkdVu/HVXIGhppMietdBL+VTEj5cfxpwlu3xkIMbX+S8Eou mZO7LlZ/RWfHY9vaandD+OH/wtwrLVHONOXAqLDC0Q2j1UiGiq2qhcqEpDFw4iVKfNpm QH0NJ/kWH1MfAK3VsUy4wwoxVDWJpb31sCgRCuoOPl4JtZcEcAAXZp9kqySrCq+zbUfw iWETGgENAjt5okjnNUaN0klEZJwkt3IcH0vkj5TFBd1VVKRxC4Rfk2EypS2PqnsTdtv7 I/DyYKeELeSl+iPxidZx5f9GNJdC3U+old4LE61H1+HME3Rp+aZdSV0o9Gd5Ta+K8ZMX k/OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787557380; x=1788162180; 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=TAcQKsiHHrhl5U4tNXvyThYZ1gGnGcacUCSiyofhb0k=; b=OljBzcNdVWGilsZCYWO6IZkShxbk+FYQ7JR7r7QNf+HeY7nDh2Aca+wvSfP5Fc9W6s +nbB1aYwHi/3a804AU08a8LeZg1xVKkSFt8NYG9xZK4gYBMuvrgVmScfrtlCDkUU+H9u 9xevvX5HKrdoGruFd91CujxRHzoleIIe9kQMmtZ8yYuo+eSYrZ1Bb5cLJ5+JwG1djeRC cYt+xouCaJx/is9ZnJTO4KJc2d+IatdGNkHbDx2+bpFKbc4EpoLCwGcYoWSuNQBqobwC +z7UTsIutpy2VCN2ajn8c0i0SXO4KdTM+m/6Z7ufUHXJEkrRrNM3Zq5K/r2vZ2u8YvmB x8Zw== X-Forwarded-Encrypted: i=1; AHgh+RrAbhU4KiQ0iS5s7NVO4HAjayXchRiHbUtf8EduA+mEHhmksz0uKbGb22ajknA49EFAdnYFx//QGoKWdU8=@vger.kernel.org X-Gm-Message-State: AFuF++lPmUl/fo+EEfl9awLUqRBTlWCnRWlY0hEJcKXLZCWxLKFrsalS cc97kDR8x7HulLcCSKq8hXR5Q45iCzHlwrRE7pWTboI2bwLopsNVyHDcA66EmT85cg== X-Gm-Gg: AR+sD13ZFMaNxBvNCJj1oOPw8vqF8w7fd9X0HNJNYK+PAxo+5YTjc/EuqGvli664W9U ZFIbd0+Odr5t4sQvKbpSDqyzA34lTzmcNkVQ5ekHaUL2ZyiF65GnNLPdf8De3QjU+X0m3K/Vuvv 1zPNJySjgx0/RrKCev9bkm7y7M2qkQVCk22LlMHrCpttm6Qy4vfz6zx3uFRi23YhHvBGu0lGj/M OT2rZpa04B79sWVvvskrXHrwKnZIt/AFqlpt9g4T7HJM0fS8YuuyFbFGIjHbyTGa7QpDWLI0Yr9 Ag/Bvy8UnIRjQy2rjkKebM6hJk4LxvyTX9RsZvTr2KNqn35bjqAhGOJJ0pM914LTQpKD0f8sy0L cPwskRMn66YudAWUp5Yr2mP6mOV1qi2G0q7R+4TlbsgTO0uSUYTyx4GA/+EdkR2p2p965iHI/aC LqkkuSvsD7ss9Gsl5woNWLGXEE/nlhCXW86ImUWAtvalTWon6BzsSfe/r1QWV68CbYQ1IvVjEmA pHdj3ZA7ihsaEAWi2HrbddUxVMzDT/Ih8KPdkIUk0KVL6WgVLimOtEyOnuacwUQi+8gBGl33R9q 0VK4iBbDkKzJpHQeJtHsUdlbHBM/GC0zL9+q+5ouOs+h1D1FhazFOKNXnYV2t4RFEiP1usKAjoz OEgCYpKTviK2OfZ8GSiiwGvyTcdJDLXHQ+Kd5SUro9LQyHRT5DVYdBrRlzG/iRrvdbobiddBTv3 lV133Wi78rP4+eptYS9DE677nh X-Received: by 2002:a17:907:98d:b0:c12:b2db:873d with SMTP id a640c23a62f3a-c246a2ec634mr3075330866b.5.1787557379883; Mon, 24 Aug 2026 00:42:59 -0700 (PDT) Received: from Desktop (p54affeee.dip0.t-ipconnect.de. [84.175.254.238]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c249685ef7bsm1261549266b.52.2026.08.24.00.42.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2026 00:42:59 -0700 (PDT) From: Julius Bairaktaris To: jjohnson@kernel.org Cc: linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH ath-next v2 9/9] wifi: ath11k: budget the tx completion handler Date: Mon, 24 Aug 2026 09:42:28 +0200 Message-ID: <20260824074228.2114579-10-julius@bairaktaris.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260824074228.2114579-1-julius@bairaktaris.de> References: <20260824074228.2114579-1-julius@bairaktaris.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" ath11k_dp_service_srng() calls ath11k_dp_tx_completion_handler() without a budget and discards its result, while every receive block below it takes the NAPI budget as a bound and reports what it consumed. The handler drains the whole software status FIFO, which holds one entry short of the 32768-entry release ring, and each entry costs a DMA unmap, an idr removal, a peer lookup under the base lock and a call into ieee80211_tx_status_ext(). One poll can therefore run for as long as the hardware has completions to report, with the receive rings behind it waiting, and the scheduling round the handler now ends with adds to that. Bound the drain by the budget it is given and account for it the way the receive blocks do. No new constant is introduced: the currency is the NAPI weight the poll already carries, so a poll that spends it on completions returns and is rescheduled rather than running on. Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.9.0.1-02146-QCAHKSWPL_SILICONZ-1 Assisted-by: Claude:claude-opus-5 Signed-off-by: Julius Bairaktaris --- drivers/net/wireless/ath/ath11k/dp.c | 10 ++++++++-- drivers/net/wireless/ath/ath11k/dp_tx.c | 11 +++++++++-- drivers/net/wireless/ath/ath11k/dp_tx.h | 3 ++- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/dp.c b/drivers/net/wireless/at= h/ath11k/dp.c index f389b97acbdd..676440ee742a 100644 --- a/drivers/net/wireless/ath/ath11k/dp.c +++ b/drivers/net/wireless/ath/ath11k/dp.c @@ -781,8 +781,14 @@ int ath11k_dp_service_srng(struct ath11k_base *ab, =20 for (i =3D 0; i < ab->hw_params.hal_params->num_tx_rings; i++) { if (BIT(ab->hw_params.hal_params->tcl2wbm_rbm_map[i].wbm_ring_num) & - ab->hw_params.ring_mask->tx[grp_id]) - ath11k_dp_tx_completion_handler(ab, i); + ab->hw_params.ring_mask->tx[grp_id]) { + work_done =3D + ath11k_dp_tx_completion_handler(ab, i, budget); + budget -=3D work_done; + tot_work_done +=3D work_done; + if (budget <=3D 0) + goto done; + } } =20 if (ab->hw_params.ring_mask->rx_err[grp_id]) { diff --git a/drivers/net/wireless/ath/ath11k/dp_tx.c b/drivers/net/wireless= /ath/ath11k/dp_tx.c index 2270b2079297..0a4381870496 100644 --- a/drivers/net/wireless/ath/ath11k/dp_tx.c +++ b/drivers/net/wireless/ath/ath11k/dp_tx.c @@ -685,7 +685,8 @@ static inline void ath11k_dp_tx_status_parse(struct ath= 11k_base *ab, ts->rate_stats =3D 0; } =20 -void ath11k_dp_tx_completion_handler(struct ath11k_base *ab, int ring_id) +int ath11k_dp_tx_completion_handler(struct ath11k_base *ab, int ring_id, + int budget) { struct ath11k *ar; struct ath11k_dp *dp =3D &ab->dp; @@ -695,6 +696,7 @@ void ath11k_dp_tx_completion_handler(struct ath11k_base= *ab, int ring_id) struct hal_tx_status ts =3D {}; struct dp_tx_ring *tx_ring =3D &dp->tx_ring[ring_id]; unsigned long push =3D 0; + int done =3D 0; u32 *desc; u32 msdu_id; u8 mac_id, i; @@ -723,10 +725,13 @@ void ath11k_dp_tx_completion_handler(struct ath11k_ba= se *ab, int ring_id) =20 spin_unlock_bh(&status_ring->lock); =20 - while (ATH11K_TX_COMPL_NEXT(tx_ring->tx_status_tail) !=3D tx_ring->tx_sta= tus_head) { + while (done < budget && + ATH11K_TX_COMPL_NEXT(tx_ring->tx_status_tail) !=3D + tx_ring->tx_status_head) { struct hal_wbm_release_ring *tx_status; u32 desc_id; =20 + done++; tx_ring->tx_status_tail =3D ATH11K_TX_COMPL_NEXT(tx_ring->tx_status_tail); tx_status =3D &tx_ring->tx_status[tx_ring->tx_status_tail]; @@ -772,6 +777,8 @@ void ath11k_dp_tx_completion_handler(struct ath11k_base= *ab, int ring_id) */ for_each_set_bit(i, &push, ab->num_radios) ath11k_mac_tx_push_pending(ab->pdevs[i].ar); + + return done; } =20 int ath11k_dp_tx_send_reo_cmd(struct ath11k_base *ab, struct dp_rx_tid *rx= _tid, diff --git a/drivers/net/wireless/ath/ath11k/dp_tx.h b/drivers/net/wireless= /ath/ath11k/dp_tx.h index 9303b5ba6e01..b5296cda73e3 100644 --- a/drivers/net/wireless/ath/ath11k/dp_tx.h +++ b/drivers/net/wireless/ath/ath11k/dp_tx.h @@ -21,7 +21,8 @@ void ath11k_dp_tx_update_txcompl(struct ath11k *ar, struc= t hal_tx_status *ts); int ath11k_dp_tx_htt_h2t_ver_req_msg(struct ath11k_base *ab); int ath11k_dp_tx(struct ath11k *ar, struct ath11k_vif *arvif, struct ath11k_sta *arsta, struct sk_buff *skb); -void ath11k_dp_tx_completion_handler(struct ath11k_base *ab, int ring_id); +int ath11k_dp_tx_completion_handler(struct ath11k_base *ab, int ring_id, + int budget); int ath11k_dp_tx_send_reo_cmd(struct ath11k_base *ab, struct dp_rx_tid *rx= _tid, enum hal_reo_cmd_type type, struct ath11k_hal_reo_cmd *cmd, --=20 2.53.0