From nobody Fri Sep 25 03:16:20 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E4EEF4457C9 for ; Thu, 17 Sep 2026 06:48:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789627727; cv=none; b=daxQeNgWm+tUvCWuHji8FN12kNbcxelGjjQXUqwGzIw43zglTb5lebReu4gXeJX7p/erL8p6Klu4oo9DR7Vm6yy9Ozi24QwmHZR/ZpHd1jCGZF/cfeIm1PISYgPU14oFyLtvWbdXM5HNAKWT8drArF+XdZUf2uo5m+FPx3/DJZ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789627727; c=relaxed/simple; bh=Vaksf6mVkDt6qpn4MgBSFQTD9uTAPkA0fjL78cwCe78=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hvDbWWR/oeXRAy1SN4gAKTR6ut+7AJyadRKIddvFD6ZWUOcKhS+ljCuag9pdm1qVwRyZOOh0Ryb+WaTtM8NuB9UlRePLd5PVJkbrqOrYGnrehBUqrKJ9ToQh/Bev60kdBA0X01HeJE5HBkQdmvG2fjZ1AfuuF6GnlddLZzGYrKk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=OVTV6C1I; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="OVTV6C1I" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789627724; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=x33XW/wjXt6WHIS6oNPy0fJBTUtYpgjF1Fs3XuRG47o=; b=OVTV6C1IXegNp8UulnN29yFoM5tEi+VbUDdNeKw+JRi/Czrytb/bcTCSkGvm2vkQUhRXDW jdN/8412ukLwHCPd/MjtSPTKM15IFLdf9VPCC4URn5AhJ383EZ8+eT31O2/HxX0GW6yJtU P3mnMQuYhGnSTSyqkd3iCZvZmQwHCEk= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-692-zgYYo98xPMa2CbqBBl4t5w-1; Thu, 17 Sep 2026 02:48:41 -0400 X-MC-Unique: zgYYo98xPMa2CbqBBl4t5w-1 X-Mimecast-MFC-AGG-ID: zgYYo98xPMa2CbqBBl4t5w_1789627719 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E9583195F140; Thu, 17 Sep 2026 06:48:36 +0000 (UTC) Received: from fedora.redhat.corp (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D02F33003EED; Thu, 17 Sep 2026 06:48:34 +0000 (UTC) From: Jose Ignacio Tornos Martinez To: jjohnson@kernel.org Cc: ath11k@lists.infradead.org, ath12k@lists.infradead.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Jose Ignacio Tornos Martinez Subject: [PATCH v7 1/4] wifi: ath11k: use queue mapping for WCN6750 ring selection Date: Thu, 17 Sep 2026 08:48:22 +0200 Message-ID: <20260917064825.12747-2-jtornosm@redhat.com> In-Reply-To: <20260917064825.12747-1-jtornosm@redhat.com> References: <20260917064825.12747-1-jtornosm@redhat.com> 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 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Content-Type: text/plain; charset="utf-8" WCN6750 selects the TCL ring using skb_get_hash() to distribute flows across its 3 TX rings, as introduced in commit 7636c9a6e7d7 ("wifi: ath11k: Add multi TX ring support for WCN6750"). The goal was to prevent out-of-order packet delivery that could occur with smp_processor_id()-based selection, where packets of the same flow could end up on different rings depending on CPU scheduling. Switch to skb_get_queue_mapping() instead, which returns the AC (access category) assigned by mac80211 in ieee80211_select_queue(). This provides the same ordering guarantee: packets of the same TID always map to the same AC and therefore always land on the same ring, preventing reordering. Using queue mapping for ring selection also provides QoS-aware distribution, where each traffic class gets a deterministic ring assignment, rather than the random distribution that flow hashing produces. With 3 rings and 4 ACs (VO=3D0, VI=3D1, BE=3D2, BK=3D3), the mapping becomes: VO and BK share ring 0, VI uses ring 1, and BE uses ring 2. This matches the approach already used by ath12k for WCN7850, which has the same ring count and uses skb_get_queue_mapping() for its ring selector. This change also removes the dependency on skb_get_hash(), which is relevant for a subsequent patch that removes the skb parameter from the get_ring_selector hw_ops callback entirely, enabling TX flow control in wake_tx_queue without requiring a complex peek to inspect frames before dequeue. Signed-off-by: Jose Ignacio Tornos Martinez --- v7: no modification v6: https://lore.kernel.org/all/20260811172435.616200-2-jtornosm@redhat.com/ drivers/net/wireless/ath/ath11k/hw.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/hw.c b/drivers/net/wireless/at= h/ath11k/hw.c index 93f9a03c48dc..d679e39dce03 100644 --- a/drivers/net/wireless/ath/ath11k/hw.c +++ b/drivers/net/wireless/ath/ath11k/hw.c @@ -891,13 +891,7 @@ static u32 ath11k_hw_ipq8074_get_tcl_ring_selector(str= uct sk_buff *skb) =20 static u32 ath11k_hw_wcn6750_get_tcl_ring_selector(struct sk_buff *skb) { - /* Select the TCL ring based on the flow hash of the SKB instead - * of CPU ID. Since applications pumping the traffic can be scheduled - * on multiple CPUs, there is a chance that packets of the same flow - * could end on different TCL rings, this could sometimes results in - * an out of order arrival of the packets at the receiver. - */ - return skb_get_hash(skb); + return skb_get_queue_mapping(skb); } =20 const struct ath11k_hw_ops ipq8074_ops =3D { --=20 2.54.0 From nobody Fri Sep 25 03:16:20 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B31F7449B03 for ; Thu, 17 Sep 2026 06:48:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789627730; cv=none; b=I0MER1WnaD76B/BFNY+jYH4/oW71H7hqqqeDrl3Vl3gA1aWPkrWKw/yBIdJCn5lEYHT/KVERbKsF3YvEDtD+Zj4FQgGtYI60mYHkXPvDG86yLPhRrv6l8jkfrf2+ls/1slLqqg7L4M0U/bupeDyxmasCmDOuvIP8g0nkG7Vbris= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789627730; c=relaxed/simple; bh=CEpJyq/hjS8t5UBqfjZn5pzdPFA9v+Zwsj+HmpyKEvE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tVKXui8676VlmgW+ePaSO7K2m0taU0+L6IxkU/b9TqZPRcLEcvEGm5s/LyxyOWJHqdu39TrGvLHp8YK9y6iUUHZJ3l2MrKEMoLjstpjPi4Da+ENcUZ/PV6c4kckFXUgiTRtlFX3buieySTMvsyk9z5cWr3KpBkxrr98nhOMTaYw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=C0x3+Qa2; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="C0x3+Qa2" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789627727; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8BvwKJBaZPPO+BAHRJAuAJtP1LgIydgRzkhLQXlvDas=; b=C0x3+Qa2z/UAcJqrAlMtEmecsxRONwTYdMhNz7WW/kdPXnL29TV1+i89mK7GEEsL/nCPrz 3dst8myN247sOH66WeKGtufcOpoVLh2ouuliARYsXnXuE+rFgEJY28pMrVJZxyrkb6TSY/ beQHefEtvk8eLCw5zh4UPaJAs1AMQVw= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-468-6o80voZUPnqTsx571nw4Cg-1; Thu, 17 Sep 2026 02:48:45 -0400 X-MC-Unique: 6o80voZUPnqTsx571nw4Cg-1 X-Mimecast-MFC-AGG-ID: 6o80voZUPnqTsx571nw4Cg_1789627723 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CA3451954237; Thu, 17 Sep 2026 06:48:43 +0000 (UTC) Received: from fedora.redhat.corp (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1BA2C3003EED; Thu, 17 Sep 2026 06:48:41 +0000 (UTC) From: Jose Ignacio Tornos Martinez To: jjohnson@kernel.org Cc: ath11k@lists.infradead.org, ath12k@lists.infradead.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Jose Ignacio Tornos Martinez Subject: [PATCH v7 2/4] wifi: ath11k/ath12k: remove skb parameter from get_ring_selector Date: Thu, 17 Sep 2026 08:48:23 +0200 Message-ID: <20260917064825.12747-3-jtornosm@redhat.com> In-Reply-To: <20260917064825.12747-1-jtornosm@redhat.com> References: <20260917064825.12747-1-jtornosm@redhat.com> 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 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Content-Type: text/plain; charset="utf-8" Change the get_ring_selector hw_ops callback signature from get_ring_selector(struct sk_buff *skb) to get_ring_selector(u8 ac), removing the dependency on the skb. After the previous patch switched WCN6750 from skb_get_hash() to skb_get_queue_mapping(), all get_ring_selector implementations fall into two categories: - smp_processor_id(): ignores the skb entirely - skb_get_queue_mapping(): only reads the AC value from the skb Since the AC is the only information extracted from the skb, pass it directly as a u8 parameter instead. Callers in the dp_tx path now pass skb_get_queue_mapping(skb), which preserves the exact same behavior. This change enables a subsequent patch to call get_ring_selector() from wake_tx_queue using txq->ac, without needing access to the skb. mac80211 guarantees that skb_get_queue_mapping(skb) =3D=3D txq->ac for any skb dequeued from a given txq, since both values are derived from the same skb->priority through the same AC mapping. No functional change. Signed-off-by: Jose Ignacio Tornos Martinez --- v7: no modification v6: https://lore.kernel.org/all/20260811172435.616200-3-jtornosm@redhat.com/ drivers/net/wireless/ath/ath11k/dp_tx.c | 2 +- drivers/net/wireless/ath/ath11k/hw.c | 16 ++++------------ drivers/net/wireless/ath/ath11k/hw.h | 2 +- drivers/net/wireless/ath/ath12k/hw.h | 2 +- drivers/net/wireless/ath/ath12k/wifi7/dp_tx.c | 2 +- drivers/net/wireless/ath/ath12k/wifi7/hw.c | 6 +++--- 6 files changed, 11 insertions(+), 19 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/dp_tx.c b/drivers/net/wireless= /ath/ath11k/dp_tx.c index cac970c92806..083aca8ff355 100644 --- a/drivers/net/wireless/ath/ath11k/dp_tx.c +++ b/drivers/net/wireless/ath/ath11k/dp_tx.c @@ -108,7 +108,7 @@ int ath11k_dp_tx(struct ath11k *ar, struct ath11k_vif *= arvif, =20 pool_id =3D skb_get_queue_mapping(skb) & (ATH11K_HW_MAX_QUEUES - 1); =20 - ring_selector =3D ab->hw_params.hw_ops->get_ring_selector(skb); + ring_selector =3D ab->hw_params.hw_ops->get_ring_selector(skb_get_queue_m= apping(skb)); =20 tcl_ring_sel: tcl_ring_retry =3D false; diff --git a/drivers/net/wireless/ath/ath11k/hw.c b/drivers/net/wireless/at= h/ath11k/hw.c index d679e39dce03..8a28c1d4c17b 100644 --- a/drivers/net/wireless/ath/ath11k/hw.c +++ b/drivers/net/wireless/ath/ath11k/hw.c @@ -876,22 +876,14 @@ static bool ath11k_hw_wcn6855_rx_desc_get_ldpc_suppor= t(struct hal_rx_desc *desc) __le32_to_cpu(desc->u.wcn6855.msdu_start.info2)); } =20 -static u32 ath11k_hw_ipq8074_get_tcl_ring_selector(struct sk_buff *skb) -{ - /* Let the default ring selection be based on current processor - * number, where one of the 3 tcl rings are selected based on - * the smp_processor_id(). In case that ring - * is full/busy, we resort to other available rings. - * If all rings are full, we drop the packet. - * - * TODO: Add throttling logic when all rings are full - */ +static u32 ath11k_hw_ipq8074_get_tcl_ring_selector(u8 ac) +{ return smp_processor_id(); } =20 -static u32 ath11k_hw_wcn6750_get_tcl_ring_selector(struct sk_buff *skb) +static u32 ath11k_hw_wcn6750_get_tcl_ring_selector(u8 ac) { - return skb_get_queue_mapping(skb); + return ac; } =20 const struct ath11k_hw_ops ipq8074_ops =3D { diff --git a/drivers/net/wireless/ath/ath11k/hw.h b/drivers/net/wireless/at= h/ath11k/hw.h index 4996536fbd14..b6bc8b72d812 100644 --- a/drivers/net/wireless/ath/ath11k/hw.h +++ b/drivers/net/wireless/ath/ath11k/hw.h @@ -273,7 +273,7 @@ struct ath11k_hw_ops { u16 (*mpdu_info_get_peerid)(struct hal_rx_mpdu_info *mpdu_info); bool (*rx_desc_mac_addr2_valid)(struct hal_rx_desc *desc); u8* (*rx_desc_mpdu_start_addr2)(struct hal_rx_desc *desc); - u32 (*get_ring_selector)(struct sk_buff *skb); + u32 (*get_ring_selector)(u8 ac); }; =20 extern const struct ath11k_hw_ops ipq8074_ops; diff --git a/drivers/net/wireless/ath/ath12k/hw.h b/drivers/net/wireless/at= h/ath12k/hw.h index 86fb8b719613..65caa7a2349f 100644 --- a/drivers/net/wireless/ath/ath12k/hw.h +++ b/drivers/net/wireless/ath/ath12k/hw.h @@ -243,7 +243,7 @@ struct ath12k_hw_ops { int (*mac_id_to_pdev_id)(const struct ath12k_hw_params *hw, int mac_id); int (*mac_id_to_srng_id)(const struct ath12k_hw_params *hw, int mac_id); int (*rxdma_ring_sel_config)(struct ath12k_base *ab); - u8 (*get_ring_selector)(struct sk_buff *skb); + u8 (*get_ring_selector)(u8 ac); bool (*dp_srng_is_tx_comp_ring)(int ring_num); bool (*is_frame_link_agnostic)(struct ath12k_link_vif *arvif, struct ieee80211_mgmt *mgmt); diff --git a/drivers/net/wireless/ath/ath12k/wifi7/dp_tx.c b/drivers/net/wi= reless/ath/ath12k/wifi7/dp_tx.c index d2749de44553..74359e8eea47 100644 --- a/drivers/net/wireless/ath/ath12k/wifi7/dp_tx.c +++ b/drivers/net/wireless/ath/ath12k/wifi7/dp_tx.c @@ -111,7 +111,7 @@ int ath12k_wifi7_dp_tx(struct ath12k_pdev_dp *dp_pdev, = struct ath12k_link_vif *a * If all rings are full, we drop the packet. * TODO: Add throttling logic when all rings are full */ - ring_selector =3D dp->hw_params->hw_ops->get_ring_selector(skb); + ring_selector =3D dp->hw_params->hw_ops->get_ring_selector(skb_get_queue_= mapping(skb)); =20 tcl_ring_sel: tcl_ring_retry =3D false; diff --git a/drivers/net/wireless/ath/ath12k/wifi7/hw.c b/drivers/net/wirel= ess/ath/ath12k/wifi7/hw.c index d9fdd2fc8298..7436cf70925a 100644 --- a/drivers/net/wireless/ath/ath12k/wifi7/hw.c +++ b/drivers/net/wireless/ath/ath12k/wifi7/hw.c @@ -49,7 +49,7 @@ ath12k_wifi7_hw_mac_id_to_srng_id_qcn9274(const struct at= h12k_hw_params *hw, return 0; } =20 -static u8 ath12k_wifi7_hw_get_ring_selector_qcn9274(struct sk_buff *skb) +static u8 ath12k_wifi7_hw_get_ring_selector_qcn9274(u8 ac) { return smp_processor_id(); } @@ -83,9 +83,9 @@ ath12k_wifi7_hw_mac_id_to_srng_id_wcn7850(const struct at= h12k_hw_params *hw, return mac_id; } =20 -static u8 ath12k_wifi7_hw_get_ring_selector_wcn7850(struct sk_buff *skb) +static u8 ath12k_wifi7_hw_get_ring_selector_wcn7850(u8 ac) { - return skb_get_queue_mapping(skb); + return ac; } =20 static bool ath12k_wifi7_dp_srng_is_comp_ring_wcn7850(int ring_num) --=20 2.54.0 From nobody Fri Sep 25 03:16:20 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 865E244CAC6 for ; Thu, 17 Sep 2026 06:48:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789627735; cv=none; b=l/W5b163qsz2r1y5xRJTItzjVB0ykAgGoWzK7XRfyHVjpBpGCmrw6v3iK2ZJAkHgQMHQclBmZ7kMP7r4+Bz/d8IWGchRAG8YtCGbn9pErixipZk/5JXXMMUiLWH84bC6SRIo3czV2N+ncfTVmcF1/PJjCoBx+pUZn9/TSXOGGvk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789627735; c=relaxed/simple; bh=01eRFQ7LSLh8qG+6wJMoerO8C0FRiqVY+wFFfWk3lus=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HXaHnT/hT/Tzc9JrrnfEfiJajiaoXmw5egBcbLM7A2tRLMcSTVaxsaiSas7bTbp9rM5D/kRwsQRBgtI2UyRKZFsKSBOeZAU+1JMo1tjZLGrPXlF3xQX7oCl+7riw1YTDs9+2KUECTkYdHOqAuyxK+YbjbL9kPgEmoNav5LbgUqw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=D3d6iiSi; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="D3d6iiSi" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789627732; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xhy1oPI87yyvqHmm/cTWCpICGutbjIXVcLaiKDJSziQ=; b=D3d6iiSi9YEsU1iXs+iyw5I/6N8um3t7MNtmhAIf1Q0ER+kvsgC8YyyRdKHjOjMnmb8q9i yibJ2sGJ6XgZzoJvQINh6xvBGCsPEW71Fk7Vv6gZxsNnD3nt9+rko2OKGOUtm1FQfudcu6 MZF7nCv5KEI9Nx+l4m7DL7hF01BvwiM= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-155-FId06UmSPnGcBkT7AMkqSw-1; Thu, 17 Sep 2026 02:48:48 -0400 X-MC-Unique: FId06UmSPnGcBkT7AMkqSw-1 X-Mimecast-MFC-AGG-ID: FId06UmSPnGcBkT7AMkqSw_1789627727 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B9D34180A98A; Thu, 17 Sep 2026 06:48:47 +0000 (UTC) Received: from fedora.redhat.corp (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 072893003EED; Thu, 17 Sep 2026 06:48:45 +0000 (UTC) From: Jose Ignacio Tornos Martinez To: jjohnson@kernel.org Cc: ath11k@lists.infradead.org, ath12k@lists.infradead.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Jose Ignacio Tornos Martinez Subject: [PATCH v7 3/4] wifi: ath11k: implement custom wake_tx_queue with flow control Date: Thu, 17 Sep 2026 08:48:24 +0200 Message-ID: <20260917064825.12747-4-jtornosm@redhat.com> In-Reply-To: <20260917064825.12747-1-jtornosm@redhat.com> References: <20260917064825.12747-1-jtornosm@redhat.com> 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 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Content-Type: text/plain; charset="utf-8" Under heavy traffic, ath11k experiences frequent -ENOMEM errors ("failed to transmit frame -12") when the hardware TCL ring fills up. This issue is more commonly observed in VMs with PCIe passthrough but also occurs on bare metal systems. It is particularly problematic on devices with a single shared TCL ring where all traffic classes compete for the same 512 descriptor slots. Implement a custom wake_tx_queue operation that: 1. Checks hardware ring space before dequeuing packets from mac80211 2. Uses per-ring locking (wake_tx_lock with spin_lock_bh) to serialize concurrent wake_tx_queue calls targeting the same ring and to ensure bottom halves are disabled as required by ieee80211_tx_dequeue() 3. Syncs with hardware state to get accurate free slot count 4. Resolves the target TCL ring using get_ring_selector(txq->ac), which selects the ring based on the access category 5. Returns early during firmware crash in the same way as other tx paths This approach follows the pattern used in the iwlwifi driver, adapted for ath11k's hardware ring architecture. This eliminates -ENOMEM errors and improves throughput by optimizing resource usage and preventing unnecessary packet drops. Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_L= ITE-3.6510.41 Signed-off-by: Jose Ignacio Tornos Martinez --- v7: Address comments from Jeff Johnson: - Add the defensive pattern _bh in both spinlocks v6: https://lore.kernel.org/all/20260811172435.616200-4-jtornosm@redhat.com/ drivers/net/wireless/ath/ath11k/dp.c | 1 + drivers/net/wireless/ath/ath11k/dp.h | 2 ++ drivers/net/wireless/ath/ath11k/mac.c | 49 ++++++++++++++++++++++++++- 3 files changed, 51 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath11k/dp.c b/drivers/net/wireless/at= h/ath11k/dp.c index f389b97acbdd..2e5978ec2b05 100644 --- a/drivers/net/wireless/ath/ath11k/dp.c +++ b/drivers/net/wireless/ath/ath11k/dp.c @@ -1087,6 +1087,7 @@ int ath11k_dp_alloc(struct ath11k_base *ab) for (i =3D 0; i < ab->hw_params.hal_params->num_tx_rings; i++) { idr_init(&dp->tx_ring[i].txbuf_idr); 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; =20 dp->tx_ring[i].tx_status_head =3D 0; diff --git a/drivers/net/wireless/ath/ath11k/dp.h b/drivers/net/wireless/at= h/ath11k/dp.h index 84f66839f0c6..6d99501aa269 100644 --- a/drivers/net/wireless/ath/ath11k/dp.h +++ b/drivers/net/wireless/ath/ath11k/dp.h @@ -87,6 +87,8 @@ struct dp_tx_ring { struct idr txbuf_idr; /* Protects txbuf_idr and num_pending */ spinlock_t tx_idr_lock; + /* Serializes wake_tx_queue operations for this ring */ + spinlock_t wake_tx_lock; struct hal_wbm_release_ring *tx_status; int tx_status_head; int tx_status_tail; diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/a= th/ath11k/mac.c index 2d55cdc4d165..da006ae5ea79 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -10065,9 +10065,56 @@ static int ath11k_mac_op_sta_state(struct ieee8021= 1_hw *hw, return ret; } =20 +static void ath11k_mac_op_wake_tx_queue(struct ieee80211_hw *hw, + struct ieee80211_txq *txq) +{ + struct ieee80211_tx_control control =3D { + .sta =3D txq->sta, + }; + struct ath11k *ar =3D hw->priv; + struct dp_tx_ring *tx_ring; + struct hal_srng *tcl_ring; + struct sk_buff *skb; + u32 ring_selector; + int num_free; + u8 ring_id; + + ring_selector =3D ar->ab->hw_params.hw_ops->get_ring_selector(txq->ac); + ring_id =3D ring_selector % ar->ab->hw_params.hal_params->num_tx_rings; + 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]; + + while (1) { + if (unlikely(test_bit(ATH11K_FLAG_CRASH_FLUSH, + &ar->ab->dev_flags))) + break; + + spin_lock_bh(&tx_ring->wake_tx_lock); + + spin_lock_bh(&tcl_ring->lock); + num_free =3D ath11k_hal_srng_src_num_free(ar->ab, tcl_ring, true); + spin_unlock_bh(&tcl_ring->lock); + + if (num_free =3D=3D 0) { + spin_unlock_bh(&tx_ring->wake_tx_lock); + break; + } + + skb =3D ieee80211_tx_dequeue(hw, txq); + if (!skb) { + spin_unlock_bh(&tx_ring->wake_tx_lock); + break; + } + + ath11k_mac_op_tx(hw, &control, skb); + + spin_unlock_bh(&tx_ring->wake_tx_lock); + } +} + 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, --=20 2.54.0 From nobody Fri Sep 25 03:16:20 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 547784519A0 for ; Thu, 17 Sep 2026 06:48:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789627738; cv=none; b=gm2zLAjwkceMseqtMSy5jC9IBy+Yc/U3onDa5tAsVUHwrIACGhl5A/+B2q8lUcv1aW9l0rNAAkWE2Wh+h4PT6a1Ana3R1vdau/OV6TUB6FgcDJU7fjOLqGVzquPDBAJstZdmgAdSglBFzwKIa0dRQ0qzPUAf6Ab5sDVA0mXFNWA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789627738; c=relaxed/simple; bh=GuEvA3JdECBFpURHxbEYLFHZ0dyaUULS9nWuHwN13YA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SN5X8YJzlbPu3KmNk9kN7iMKSJ3y3LmXxmwx8UGufJpkMQhOuHyGmdy8L0lOwXol/10rPVedhp3Q4f4SJlACak6Q+T0N/ZMoGyB/WE2pTVjXl67Z0PZ48TGNBB3jjm6KQyuFi/BsA6wVfvwh5nyeEie89ro0Hndy2hdQ1COpO3I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Wr1e8G5U; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Wr1e8G5U" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789627736; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nBOKDWHJ5d/WX+9vDbLuOmrdk3Z30++1D+Jr/5PySfA=; b=Wr1e8G5UZTjN8RF4Sme6EYrjHPWRpXcp/9C082akX344ABwT7B5UWTewkanZv6Q/Gii84u MRKo1BPaHCX/hdHaUiyt0swpwxCj7iJjCGjjqTqdTxImCejcPPxWJmKAgtD1v3l8ePXHzU BwLdKI9AfOrYwqPbxso6CGLTPXyN5e4= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-311-1nHO73epMROil569RZVwAQ-1; Thu, 17 Sep 2026 02:48:53 -0400 X-MC-Unique: 1nHO73epMROil569RZVwAQ-1 X-Mimecast-MFC-AGG-ID: 1nHO73epMROil569RZVwAQ_1789627732 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D75BE1955DB9; Thu, 17 Sep 2026 06:48:51 +0000 (UTC) Received: from fedora.redhat.corp (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id F366F3003EF4; Thu, 17 Sep 2026 06:48:49 +0000 (UTC) From: Jose Ignacio Tornos Martinez To: jjohnson@kernel.org Cc: ath11k@lists.infradead.org, ath12k@lists.infradead.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Jose Ignacio Tornos Martinez Subject: [PATCH v7 4/4] wifi: ath12k: implement custom wake_tx_queue with flow control Date: Thu, 17 Sep 2026 08:48:25 +0200 Message-ID: <20260917064825.12747-5-jtornosm@redhat.com> In-Reply-To: <20260917064825.12747-1-jtornosm@redhat.com> References: <20260917064825.12747-1-jtornosm@redhat.com> 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 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Content-Type: text/plain; charset="utf-8" Under heavy traffic, ath12k can hang and experiences -ENOMEM errors ("failed to transmit frame -12") when the hardware TCL ring fills up. This issue is more commonly observed in VMs with PCIe passthrough but also occurs on bare metal systems. Implement a custom wake_tx_queue operation that: 1. Checks hardware ring space before dequeuing packets from mac80211 2. Uses per-ring locking (wake_tx_lock with spin_lock_bh) to serialize concurrent wake_tx_queue calls targeting the same ring and to ensure bottom halves are disabled as required by ieee80211_tx_dequeue() 3. Syncs with hardware state to get accurate free slot count 4. Resolves the target TCL ring once using get_ring_selector(txq->ac), which selects the ring based on the access category 5. Returns early during firmware crash in the same way as other tx paths This approach follows the pattern used in the iwlwifi driver, adapted for ath12k's hardware ring architecture. This prevents hangs, eliminates -ENOMEM errors, and improves throughput by optimizing resource usage and preventing unnecessary packet drops. Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c7-00108-QCAHMTSWPL_V1.0_V2.0_SIL= ICONZ_UPSTREAM-3 Signed-off-by: Jose Ignacio Tornos Martinez --- v7: Address comments from Jeff Johnson: - Add the defensive pattern _bh in both spinlocks v6: https://lore.kernel.org/all/20260811172435.616200-5-jtornosm@redhat.com/ drivers/net/wireless/ath/ath12k/dp.c | 1 + drivers/net/wireless/ath/ath12k/dp.h | 2 + drivers/net/wireless/ath/ath12k/hal.c | 1 + drivers/net/wireless/ath/ath12k/wifi7/hw.c | 69 +++++++++++++++++++++- 4 files changed, 72 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath12k/dp.c b/drivers/net/wireless/at= h/ath12k/dp.c index f9b37d75956d..e62fa416b992 100644 --- a/drivers/net/wireless/ath/ath12k/dp.c +++ b/drivers/net/wireless/ath/ath12k/dp.c @@ -1537,6 +1537,7 @@ static int ath12k_dp_setup(struct ath12k_base *ab) } =20 for (i =3D 0; i < ab->hw_params->max_tx_ring; i++) { + spin_lock_init(&dp->tx_ring[i].wake_tx_lock); dp->tx_ring[i].tcl_data_ring_id =3D i; =20 dp->tx_ring[i].tx_status_head =3D 0; diff --git a/drivers/net/wireless/ath/ath12k/dp.h b/drivers/net/wireless/at= h/ath12k/dp.h index bef0f2ba0560..4bf8a8a6d76c 100644 --- a/drivers/net/wireless/ath/ath12k/dp.h +++ b/drivers/net/wireless/ath/ath12k/dp.h @@ -58,6 +58,8 @@ struct dp_tx_ring { u8 tcl_data_ring_id; struct dp_srng tcl_data_ring; struct dp_srng tcl_comp_ring; + /* Serializes wake_tx_queue operations for this ring */ + spinlock_t wake_tx_lock; struct hal_wbm_completion_ring_tx *tx_status; int tx_status_head; int tx_status_tail; diff --git a/drivers/net/wireless/ath/ath12k/hal.c b/drivers/net/wireless/a= th/ath12k/hal.c index c0c3d2f047ef..fbe4dc41e34b 100644 --- a/drivers/net/wireless/ath/ath12k/hal.c +++ b/drivers/net/wireless/ath/ath12k/hal.c @@ -390,6 +390,7 @@ int ath12k_hal_srng_src_num_free(struct ath12k_base *ab= , struct hal_srng *srng, else return ((srng->ring_size - hp + tp) / srng->entry_size) - 1; } +EXPORT_SYMBOL(ath12k_hal_srng_src_num_free); =20 void *ath12k_hal_srng_src_next_peek(struct ath12k_base *ab, struct hal_srng *srng) diff --git a/drivers/net/wireless/ath/ath12k/wifi7/hw.c b/drivers/net/wirel= ess/ath/ath12k/wifi7/hw.c index 678c512a2199..7bfeb9397465 100644 --- a/drivers/net/wireless/ath/ath12k/wifi7/hw.c +++ b/drivers/net/wireless/ath/ath12k/wifi7/hw.c @@ -1160,9 +1160,76 @@ static void ath12k_wifi7_mac_op_tx(struct ieee80211_= hw *hw, } } =20 +static void ath12k_wifi7_mac_op_wake_tx_queue(struct ieee80211_hw *hw, + struct ieee80211_txq *txq) +{ + struct ath12k_vif *ahvif =3D ath12k_vif_to_ahvif(txq->vif); + struct ieee80211_tx_control control =3D { + .sta =3D txq->sta, + }; + struct ieee80211_vif *vif =3D txq->vif; + struct ath12k_link_vif *arvif; + struct dp_tx_ring *tx_ring; + struct hal_srng *tcl_ring; + struct ath12k_sta *ahsta; + struct ath12k_dp *dp; + struct sk_buff *skb; + struct ath12k *ar; + u8 ring_selector; + int num_free; + u8 ring_id; + u8 link_id; + + if (ieee80211_vif_is_mld(vif) && txq->sta) { + ahsta =3D ath12k_sta_to_ahsta(txq->sta); + link_id =3D ahsta->assoc_link_id; + } else { + link_id =3D ahvif->deflink.link_id; + } + + rcu_read_lock(); + + arvif =3D rcu_dereference(ahvif->link[link_id]); + if (!arvif || !arvif->ar) { + rcu_read_unlock(); + return; + } + + ar =3D arvif->ar; + dp =3D ar->ab->dp; + + ring_selector =3D dp->hw_params->hw_ops->get_ring_selector(txq->ac); + ring_id =3D ring_selector % dp->hw_params->max_tx_ring; + tx_ring =3D &dp->tx_ring[ring_id]; + tcl_ring =3D &dp->hal->srng_list[tx_ring->tcl_data_ring.ring_id]; + + while (1) { + if (unlikely(test_bit(ATH12K_FLAG_CRASH_FLUSH, + &ar->ab->dev_flags))) + break; + + guard(spinlock_bh)(&tx_ring->wake_tx_lock); + + spin_lock_bh(&tcl_ring->lock); + num_free =3D ath12k_hal_srng_src_num_free(ar->ab, tcl_ring, true); + spin_unlock_bh(&tcl_ring->lock); + + if (num_free =3D=3D 0) + break; + + skb =3D ieee80211_tx_dequeue(hw, txq); + if (!skb) + break; + + ath12k_wifi7_mac_op_tx(hw, &control, skb); + } + + rcu_read_unlock(); +} + static const struct ieee80211_ops ath12k_ops_wifi7 =3D { .tx =3D ath12k_wifi7_mac_op_tx, - .wake_tx_queue =3D ieee80211_handle_wake_tx_queue, + .wake_tx_queue =3D ath12k_wifi7_mac_op_wake_tx_queue, .start =3D ath12k_mac_op_start, .stop =3D ath12k_mac_op_stop, .reconfig_complete =3D ath12k_mac_op_reconfig_complete, --=20 2.54.0