Skip to contentSkip to conversation

ath11k: add processor_id based ring_selector logic

PATCH In review P Praneesh 2 participants 3 messages Nov 9, 2020 – Nov 23, 2020 Qualcomm Atheros ATH11K wireless driver

lore
Share & tools
lore

P Praneesh

author
#0 lore raw

PATCH v3 1/1 ath11k: add processor_id based ring_selector logic

Current ring selector logic follows round-robin scheduling, when a process switch from one processor to another each time, the data in the cache would have to be invalidated and re-loaded from RAM leads to poor cache utilization.

Therefore smp_processor_id() attempt to keep processes on the same processor via processor affinity which improves cache utilization. Also, ring selection could be chosen round robin when the processor_id based ring selection does not have the resources.

Tested-on : IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-00874-QCAHKSWPL_SILICONZ-1

---
 drivers/net/wireless/ath/ath11k/core.h  | 3 ---
 drivers/net/wireless/ath/ath11k/dp_tx.c | 8 ++++----
 2 files changed, 4 insertions(+), 7 deletions(-)

---
v3: corrected commit log.
v2: corrected tested tags.
---

drivers/net/wireless/ath/ath11k/core.h +0 -3
index 1cd9ef3..c2a4a7d 100644
@@ -714,9 +714,6 @@ struct ath11k_base {
 	} stats;
 	u32 pktlog_defs_checksum;
 
-	/* Round robbin based TCL ring selector */
-	atomic_t tcl_ring_selector;
-
 	struct ath11k_dbring_cap *db_caps;
 	u32 num_db_cap;
 
drivers/net/wireless/ath/ath11k/dp_tx.c +4 -4
index a9632b7..897c368 100644
@@ -99,14 +99,14 @@ int ath11k_dp_tx(struct ath11k *ar, struct ath11k_vif *arvif,
 
 	pool_id = skb_get_queue_mapping(skb) & (ATH11K_HW_MAX_QUEUES - 1);
 
-	/* Let the default ring selection be based on a round robin
-	 * fashion where one of the 3 tcl rings are selected based on
-	 * the tcl_ring_selector counter. In case that ring
+	/* 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
 	 */
-	ring_selector = atomic_inc_return(&ab->tcl_ring_selector);
+	ring_selector = smp_processor_id();
 
 tcl_ring_sel:
 	tcl_ring_retry = false;
Signature · 1 line
2.7.4
#1 lore raw
Quoted 11 lines · P Praneesh

Current ring selector logic follows round-robin scheduling, when a process switch from one processor to another each time, the data in the cache would have to be invalidated and re-loaded from RAM leads to poor cache utilization.

Therefore smp_processor_id() attempt to keep processes on the same processor via processor affinity which improves cache utilization. Also, ring selection could be chosen round robin when the processor_id based ring selection does not have the resources.

Quoted 4 lines

Tested-on : IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-00874-QCAHKSWPL_SILICONZ-1

Patch applied to ath-next branch of ath.git, thanks.

0eaa4c1d34c5 ath11k: add processor_id based ring_selector logic

Signature · 9 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


-- 
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k
#2 lore raw
In reply to P Praneesh
Quoted 11 lines · P Praneesh

Current ring selector logic follows round-robin scheduling, when a process switch from one processor to another each time, the data in the cache would have to be invalidated and re-loaded from RAM leads to poor cache utilization.

Therefore smp_processor_id() attempt to keep processes on the same processor via processor affinity which improves cache utilization. Also, ring selection could be chosen round robin when the processor_id based ring selection does not have the resources.

Quoted 4 lines

Tested-on : IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-00874-QCAHKSWPL_SILICONZ-1

Patch applied to ath-next branch of ath.git, thanks.

0eaa4c1d34c5 ath11k: add processor_id based ring_selector logic

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches