* [PATCH v8 1/2] wifi: ath11k: use queue mapping for WCN6750 ring selection
2026-10-21 6:07 [PATCH v8 0/3] wifi: ath11k: implement TX flow control Jose Ignacio Tornos Martinez
@ 2026-10-21 6:07 ` Jose Ignacio Tornos Martinez
2026-10-21 6:07 ` [PATCH v8 2/3] wifi: ath11k: remove skb parameter from get_ring_selector Jose Ignacio Tornos Martinez
2026-10-21 6:07 ` [PATCH v8 3/3] wifi: ath11k: implement custom wake_tx_queue with flow control Jose Ignacio Tornos Martinez
2 siblings, 0 replies; 4+ messages in thread
From: Jose Ignacio Tornos Martinez @ 2026-10-21 6:07 UTC (permalink / raw)
To: jjohnson
Cc: tamizh.raja, julius, ath11k, ath12k, linux-wireless,
linux-kernel, Jose Ignacio Tornos Martinez
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=0, VI=1, BE=2, BK=3), 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.
Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.41
Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
Tested-by: Julius Bairaktaris <julius@bairaktaris.de> # IPQ8074 WLAN.HK.2.9.0.1-02146
---
v8: Split ath11k and ath12k into separate series to avoid conflict
with Julius's airtime queue limits series (ath11k only) and help to
unblock both
No code changes from v7
v7: https://lore.kernel.org/all/20260917064825.12747-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/ath/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(struct sk_buff *skb)
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);
}
const struct ath11k_hw_ops ipq8074_ops = {
--
2.54.0
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH v8 2/3] wifi: ath11k: remove skb parameter from get_ring_selector
2026-10-21 6:07 [PATCH v8 0/3] wifi: ath11k: implement TX flow control Jose Ignacio Tornos Martinez
2026-10-21 6:07 ` [PATCH v8 1/2] wifi: ath11k: use queue mapping for WCN6750 ring selection Jose Ignacio Tornos Martinez
@ 2026-10-21 6:07 ` Jose Ignacio Tornos Martinez
2026-10-21 6:07 ` [PATCH v8 3/3] wifi: ath11k: implement custom wake_tx_queue with flow control Jose Ignacio Tornos Martinez
2 siblings, 0 replies; 4+ messages in thread
From: Jose Ignacio Tornos Martinez @ 2026-10-21 6:07 UTC (permalink / raw)
To: jjohnson
Cc: tamizh.raja, julius, ath11k, ath12k, linux-wireless,
linux-kernel, Jose Ignacio Tornos Martinez
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) == 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.
Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.41
Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
Tested-by: Julius Bairaktaris <julius@bairaktaris.de> # IPQ8074 WLAN.HK.2.9.0.1-02146
---
v8: Split ath11k and ath12k into separate series to avoid conflict
with Julius's airtime queue limits series (ath11k only) and help to
unblock both
No code changes from v7
v7: https://lore.kernel.org/all/20260917064825.12747-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 +-
3 files changed, 6 insertions(+), 14 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,
pool_id = skb_get_queue_mapping(skb) & (ATH11K_HW_MAX_QUEUES - 1);
- ring_selector = ab->hw_params.hw_ops->get_ring_selector(skb);
+ ring_selector = ab->hw_params.hw_ops->get_ring_selector(skb_get_queue_mapping(skb));
tcl_ring_sel:
tcl_ring_retry = false;
diff --git a/drivers/net/wireless/ath/ath11k/hw.c b/drivers/net/wireless/ath/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_support(struct hal_rx_desc *desc)
__le32_to_cpu(desc->u.wcn6855.msdu_start.info2));
}
-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();
}
-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;
}
const struct ath11k_hw_ops ipq8074_ops = {
diff --git a/drivers/net/wireless/ath/ath11k/hw.h b/drivers/net/wireless/ath/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);
};
extern const struct ath11k_hw_ops ipq8074_ops;
--
2.54.0
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH v8 3/3] wifi: ath11k: implement custom wake_tx_queue with flow control
2026-10-21 6:07 [PATCH v8 0/3] wifi: ath11k: implement TX flow control Jose Ignacio Tornos Martinez
2026-10-21 6:07 ` [PATCH v8 1/2] wifi: ath11k: use queue mapping for WCN6750 ring selection Jose Ignacio Tornos Martinez
2026-10-21 6:07 ` [PATCH v8 2/3] wifi: ath11k: remove skb parameter from get_ring_selector Jose Ignacio Tornos Martinez
@ 2026-10-21 6:07 ` Jose Ignacio Tornos Martinez
2 siblings, 0 replies; 4+ messages in thread
From: Jose Ignacio Tornos Martinez @ 2026-10-21 6:07 UTC (permalink / raw)
To: jjohnson
Cc: tamizh.raja, julius, ath11k, ath12k, linux-wireless,
linux-kernel, Jose Ignacio Tornos Martinez
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_LITE-3.6510.41
Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
Tested-by: Julius Bairaktaris <julius@bairaktaris.de> # IPQ8074 WLAN.HK.2.9.0.1-02146
---
v8: Split ath11k and ath12k into separate series to avoid conflict
with Julius's airtime queue limits series (ath11k only) and help to
unblock both
No code changes from v7
v7: https://lore.kernel.org/all/20260917064825.12747-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/ath/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 = 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 = i;
dp->tx_ring[i].tx_status_head = 0;
diff --git a/drivers/net/wireless/ath/ath11k/dp.h b/drivers/net/wireless/ath/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/ath/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 ieee80211_hw *hw,
return ret;
}
+static void ath11k_mac_op_wake_tx_queue(struct ieee80211_hw *hw,
+ struct ieee80211_txq *txq)
+{
+ struct ieee80211_tx_control control = {
+ .sta = txq->sta,
+ };
+ struct ath11k *ar = 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 = ar->ab->hw_params.hw_ops->get_ring_selector(txq->ac);
+ ring_id = ring_selector % ar->ab->hw_params.hal_params->num_tx_rings;
+ tx_ring = &ar->ab->dp.tx_ring[ring_id];
+ tcl_ring = &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 = ath11k_hal_srng_src_num_free(ar->ab, tcl_ring, true);
+ spin_unlock_bh(&tcl_ring->lock);
+
+ if (num_free == 0) {
+ spin_unlock_bh(&tx_ring->wake_tx_lock);
+ break;
+ }
+
+ skb = 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 = {
.tx = ath11k_mac_op_tx,
- .wake_tx_queue = ieee80211_handle_wake_tx_queue,
+ .wake_tx_queue = ath11k_mac_op_wake_tx_queue,
.start = ath11k_mac_op_start,
.stop = ath11k_mac_op_stop,
.reconfig_complete = ath11k_mac_op_reconfig_complete,
--
2.54.0
^ permalink raw reply [flat|nested] 4+ messages in thread