[PATCH 5/7] ath10k: add htt TX bundle for sdio

2019-08-20 Thread Wen Gong
The transmission utilization ratio for sdio bus for small packet is
slow, because the space and time cost for sdio bus is same for large
length packet and small length packet. So the speed of data for large
length packet is higher than small length.

Test result of different length of data:

data packet(byte)   cost time(us)   calculated rate(Mbps)
  256   2873
  512   33   124
 1024   35   234
 1792   45   318
14336  168   682
28672  333   688
57344  660   695

This patch change the TX packet from single packet to a large length
bundle packet, max size is 32, it results in significant performance
improvement on TX path.

This patch only effect sdio chip, it will not effect PCI, SNOC etc.
It only enable bundle for sdio chip.

Tested with QCA6174 SDIO with firmware
WLAN.RMH.4.4.1-7-QCARMSWP-1.

Signed-off-by: Wen Gong 
---
 drivers/net/wireless/ath/ath10k/core.c   |  14 +-
 drivers/net/wireless/ath/ath10k/core.h   |   4 +-
 drivers/net/wireless/ath/ath10k/htc.c| 353 ---
 drivers/net/wireless/ath/ath10k/htc.h|  21 +-
 drivers/net/wireless/ath/ath10k/htt.c|   8 +
 drivers/net/wireless/ath/ath10k/htt.h|   5 +
 drivers/net/wireless/ath/ath10k/htt_rx.c |   1 +
 drivers/net/wireless/ath/ath10k/htt_tx.c |   9 +-
 8 files changed, 377 insertions(+), 38 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 762bba0..351f4ed 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -3194,6 +3194,11 @@ struct ath10k *ath10k_core_create(size_t priv_size, 
struct device *dev,
if (!ar->workqueue_aux)
goto err_free_wq;
 
+   ar->workqueue_tx_complete =
+   create_singlethread_workqueue("ath10k_tx_complete_wq");
+   if (!ar->workqueue_tx_complete)
+   goto err_free_aux_wq;
+
mutex_init(&ar->conf_mutex);
mutex_init(&ar->dump_mutex);
spin_lock_init(&ar->data_lock);
@@ -3219,7 +3224,7 @@ struct ath10k *ath10k_core_create(size_t priv_size, 
struct device *dev,
 
ret = ath10k_coredump_create(ar);
if (ret)
-   goto err_free_aux_wq;
+   goto err_free_tx_complete;
 
ret = ath10k_debug_create(ar);
if (ret)
@@ -3229,12 +3234,12 @@ struct ath10k *ath10k_core_create(size_t priv_size, 
struct device *dev,
 
 err_free_coredump:
ath10k_coredump_destroy(ar);
-
+err_free_tx_complete:
+   destroy_workqueue(ar->workqueue_tx_complete);
 err_free_aux_wq:
destroy_workqueue(ar->workqueue_aux);
 err_free_wq:
destroy_workqueue(ar->workqueue);
-
 err_free_mac:
ath10k_mac_destroy(ar);
 
@@ -3250,6 +3255,9 @@ void ath10k_core_destroy(struct ath10k *ar)
flush_workqueue(ar->workqueue_aux);
destroy_workqueue(ar->workqueue_aux);
 
+   flush_workqueue(ar->workqueue_tx_complete);
+   destroy_workqueue(ar->workqueue_tx_complete);
+
ath10k_debug_destroy(ar);
ath10k_coredump_destroy(ar);
ath10k_htt_tx_destroy(&ar->htt);
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 4d7db07..be9eb37 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -1079,7 +1079,7 @@ struct ath10k {
struct workqueue_struct *workqueue;
/* Auxiliary workqueue */
struct workqueue_struct *workqueue_aux;
-
+   struct workqueue_struct *workqueue_tx_complete;
/* prevents concurrent FW reconfiguration */
struct mutex conf_mutex;
 
@@ -1120,6 +1120,8 @@ struct ath10k {
 
struct work_struct register_work;
struct work_struct restart_work;
+   struct work_struct bundle_tx_work;
+   struct work_struct tx_complete_work;
 
/* cycle count is reported twice for each visited channel during scan.
 * access protected by data_lock
diff --git a/drivers/net/wireless/ath/ath10k/htc.c 
b/drivers/net/wireless/ath/ath10k/htc.c
index 7357a5a..96b620f 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -51,10 +51,12 @@ void ath10k_htc_notify_tx_completion(struct ath10k_htc_ep 
*ep,
 struct sk_buff *skb)
 {
struct ath10k *ar = ep->htc->ar;
+   struct ath10k_htc_hdr *hdr;
 
ath10k_dbg(ar, ATH10K_DBG_HTC, "%s: ep %d skb %pK\n", __func__,
   ep->eid, skb);
 
+   hdr = (struct ath10k_htc_hdr *)skb->data;
ath10k_htc_restore_tx_skb(ep->htc, skb);
 
if (!ep->ep_ops.ep_tx_complete) {
@@ -63,6 +65,11 @@ void ath10k_htc_notify_tx_completion(struct ath10k_htc_ep 
*ep,
return;
}
 
+   if (hdr->flags & ATH10K_HTC_FLAG_SEND_BUNDLE)

RE: [PATCH 5/7] ath10k: add htt TX bundle for sdio

2019-09-03 Thread Wen Gong
> -Original Message-
> From: ath10k  On Behalf Of Wen Gong
> Sent: Tuesday, August 20, 2019 7:55 PM
> To: ath10k@lists.infradead.org
> Cc: linux-wirel...@vger.kernel.org
> Subject: [EXT] [PATCH 5/7] ath10k: add htt TX bundle for sdio
> 
Patch v2 sent, https://patchwork.kernel.org/patch/6687/

> ___
> ath10k mailing list
> ath10k@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/ath10k