Re: [PATCH] ath10k: implement NAPI support

2016-06-27 Thread Sebastian Gottschall

broken patch

  CC [M] 
/home/seg/DEV/pb42/src/router/private/compat-wireless-2016-05-12/drivers/net/wireless/ath/ath10k/htt_tx.o
/home/seg/DEV/pb42/src/router/private/compat-wireless-2016-05-12/drivers/net/wireless/ath/ath10k/htt_tx.c: 
In function 'ath10k_htt_tx_free':
/home/seg/DEV/pb42/src/router/private/compat-wireless-2016-05-12/drivers/net/wireless/ath/ath10k/htt_tx.c:391:19: 
error: 'struct ath10k_htt' has no member named 'txrx_compl_task'


Sebastian

Am 27.06.2016 um 07:51 schrieb Rajkumar Manoharan:

Add NAPI support for rx and tx completion. NAPI poll is scheduled
from interrupt handler. The design is as below

  - on interrupt
  - schedule napi and mask interrupts
  - on poll
- process all pipes (no actual Tx/Rx)
- process Rx within budget
- if quota exceeds budget reschedule napi poll by returning budget
- process Tx completions and update budget if necessary
- process Tx fetch indications (pull-push)
- push any other pending Tx (if possible)
- before resched or napi completion replenish htt rx ring buffer
- if work done < budget, complete napi poll and unmask interrupts

This change also get rid of two tasklets (intr_tq and txrx_compl_task).

Measured peak throughput with NAPI on IPQ4019 platform in controlled
environment. No noticeable reduction in throughput is seen and also
observed improvements in CPU usage. Approx. 15% CPU usage got reduced
in UDP uplink case.

DL: AP DUT Tx
UL: AP DUT Rx

IPQ4019 (avg. cpu usage %)

 TOT  +NAPI
   ===  =
TCP DL   644 Mbps (42%)645 Mbps (36%)
TCP UL   673 Mbps (30%)675 Mbps (26%)
UDP DL   682 Mbps (49%)680 Mbps (49%)
UDP UL   720 Mbps (28%)717 Mbps (11%)

Signed-off-by: Rajkumar Manoharan 
---
  drivers/net/wireless/ath/ath10k/ahb.c|   4 +-
  drivers/net/wireless/ath/ath10k/core.c   |   2 +
  drivers/net/wireless/ath/ath10k/core.h   |   8 ++
  drivers/net/wireless/ath/ath10k/htt.h|   2 +-
  drivers/net/wireless/ath/ath10k/htt_rx.c | 154 +++
  drivers/net/wireless/ath/ath10k/pci.c|  67 +-
  drivers/net/wireless/ath/ath10k/pci.h|   5 +-
  7 files changed, 149 insertions(+), 93 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/ahb.c 
b/drivers/net/wireless/ath/ath10k/ahb.c
index acec16b9cf49..9d4d5022be18 100644
--- a/drivers/net/wireless/ath/ath10k/ahb.c
+++ b/drivers/net/wireless/ath/ath10k/ahb.c
@@ -462,13 +462,11 @@ static void ath10k_ahb_halt_chip(struct ath10k *ar)
  static irqreturn_t ath10k_ahb_interrupt_handler(int irq, void *arg)
  {
struct ath10k *ar = arg;
-   struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
  
  	if (!ath10k_pci_irq_pending(ar))

return IRQ_NONE;
  
  	ath10k_pci_disable_and_clear_legacy_irq(ar);

-   tasklet_schedule(&ar_pci->intr_tq);
  
  	return IRQ_HANDLED;

  }
@@ -831,7 +829,7 @@ static int ath10k_ahb_probe(struct platform_device *pdev)
goto err_resource_deinit;
}
  
-	ath10k_pci_init_irq_tasklets(ar);

+   ath10k_pci_init_napi(ar);
  
  	ret = ath10k_ahb_request_irq_legacy(ar);

if (ret)
diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index dfb3db0ee5d1..2639e7e0836b 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -2223,6 +2223,8 @@ struct ath10k *ath10k_core_create(size_t priv_size, 
struct device *dev,
INIT_WORK(&ar->register_work, ath10k_core_register_work);
INIT_WORK(&ar->restart_work, ath10k_core_restart);
  
+	init_dummy_netdev(&ar->napi_dev);

+
ret = ath10k_debug_create(ar);
if (ret)
goto err_free_aux_wq;
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 3da18c9dbd7a..10878926b629 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -65,6 +65,10 @@
  #define ATH10K_KEEPALIVE_MAX_IDLE 3895
  #define ATH10K_KEEPALIVE_MAX_UNRESPONSIVE 3900
  
+/* NAPI poll budget */

+#define ATH10K_NAPI_BUDGET  64
+#define ATH10K_NAPI_QUOTA_LIMIT 60
+
  struct ath10k;
  
  enum ath10k_bus {

@@ -926,6 +930,10 @@ struct ath10k {
struct ath10k_thermal thermal;
struct ath10k_wow wow;
  
+	/* NAPI */

+   struct net_device napi_dev;
+   struct napi_struct napi;
+
/* must be last */
u8 drv_priv[0] __aligned(sizeof(void *));
  };
diff --git a/drivers/net/wireless/ath/ath10k/htt.h 
b/drivers/net/wireless/ath/ath10k/htt.h
index 430a83e142aa..98c14247021b 100644
--- a/drivers/net/wireless/ath/ath10k/htt.h
+++ b/drivers/net/wireless/ath/ath10k/htt.h
@@ -1665,7 +1665,6 @@ struct ath10k_htt {
  
  	/* This is used to group tx/rx completions separately and process them

 * in batches to reduce cache stalls */
-   struct tasklet_struct txrx_compl_task;
struct sk_buff_head r

Re: [PATCH] ath10k: implement NAPI support

2016-06-27 Thread Sebastian Gottschall

forget about it. it was caused by another patch here on this list.

Am 28.06.2016 um 00:45 schrieb Sebastian Gottschall:

broken patch

  CC [M] 
/home/seg/DEV/pb42/src/router/private/compat-wireless-2016-05-12/drivers/net/wireless/ath/ath10k/htt_tx.o
/home/seg/DEV/pb42/src/router/private/compat-wireless-2016-05-12/drivers/net/wireless/ath/ath10k/htt_tx.c: 
In function 'ath10k_htt_tx_free':
/home/seg/DEV/pb42/src/router/private/compat-wireless-2016-05-12/drivers/net/wireless/ath/ath10k/htt_tx.c:391:19: 
error: 'struct ath10k_htt' has no member named 'txrx_compl_task'


Sebastian

Am 27.06.2016 um 07:51 schrieb Rajkumar Manoharan:

Add NAPI support for rx and tx completion. NAPI poll is scheduled
from interrupt handler. The design is as below

  - on interrupt
  - schedule napi and mask interrupts
  - on poll
- process all pipes (no actual Tx/Rx)
- process Rx within budget
- if quota exceeds budget reschedule napi poll by returning budget
- process Tx completions and update budget if necessary
- process Tx fetch indications (pull-push)
- push any other pending Tx (if possible)
- before resched or napi completion replenish htt rx ring buffer
- if work done < budget, complete napi poll and unmask interrupts

This change also get rid of two tasklets (intr_tq and txrx_compl_task).

Measured peak throughput with NAPI on IPQ4019 platform in controlled
environment. No noticeable reduction in throughput is seen and also
observed improvements in CPU usage. Approx. 15% CPU usage got reduced
in UDP uplink case.

DL: AP DUT Tx
UL: AP DUT Rx

IPQ4019 (avg. cpu usage %)

 TOT  +NAPI
   ===  =
TCP DL   644 Mbps (42%)645 Mbps (36%)
TCP UL   673 Mbps (30%)675 Mbps (26%)
UDP DL   682 Mbps (49%)680 Mbps (49%)
UDP UL   720 Mbps (28%)717 Mbps (11%)

Signed-off-by: Rajkumar Manoharan 
---
  drivers/net/wireless/ath/ath10k/ahb.c|   4 +-
  drivers/net/wireless/ath/ath10k/core.c   |   2 +
  drivers/net/wireless/ath/ath10k/core.h   |   8 ++
  drivers/net/wireless/ath/ath10k/htt.h|   2 +-
  drivers/net/wireless/ath/ath10k/htt_rx.c | 154 
+++

  drivers/net/wireless/ath/ath10k/pci.c|  67 +-
  drivers/net/wireless/ath/ath10k/pci.h|   5 +-
  7 files changed, 149 insertions(+), 93 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/ahb.c 
b/drivers/net/wireless/ath/ath10k/ahb.c

index acec16b9cf49..9d4d5022be18 100644
--- a/drivers/net/wireless/ath/ath10k/ahb.c
+++ b/drivers/net/wireless/ath/ath10k/ahb.c
@@ -462,13 +462,11 @@ static void ath10k_ahb_halt_chip(struct ath10k 
*ar)

  static irqreturn_t ath10k_ahb_interrupt_handler(int irq, void *arg)
  {
  struct ath10k *ar = arg;
-struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
if (!ath10k_pci_irq_pending(ar))
  return IRQ_NONE;
ath10k_pci_disable_and_clear_legacy_irq(ar);
-tasklet_schedule(&ar_pci->intr_tq);
return IRQ_HANDLED;
  }
@@ -831,7 +829,7 @@ static int ath10k_ahb_probe(struct 
platform_device *pdev)

  goto err_resource_deinit;
  }
  -ath10k_pci_init_irq_tasklets(ar);
+ath10k_pci_init_napi(ar);
ret = ath10k_ahb_request_irq_legacy(ar);
  if (ret)
diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c

index dfb3db0ee5d1..2639e7e0836b 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -2223,6 +2223,8 @@ struct ath10k *ath10k_core_create(size_t 
priv_size, struct device *dev,

  INIT_WORK(&ar->register_work, ath10k_core_register_work);
  INIT_WORK(&ar->restart_work, ath10k_core_restart);
  +init_dummy_netdev(&ar->napi_dev);
+
  ret = ath10k_debug_create(ar);
  if (ret)
  goto err_free_aux_wq;
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h

index 3da18c9dbd7a..10878926b629 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -65,6 +65,10 @@
  #define ATH10K_KEEPALIVE_MAX_IDLE 3895
  #define ATH10K_KEEPALIVE_MAX_UNRESPONSIVE 3900
  +/* NAPI poll budget */
+#define ATH10K_NAPI_BUDGET  64
+#define ATH10K_NAPI_QUOTA_LIMIT 60
+
  struct ath10k;
enum ath10k_bus {
@@ -926,6 +930,10 @@ struct ath10k {
  struct ath10k_thermal thermal;
  struct ath10k_wow wow;
  +/* NAPI */
+struct net_device napi_dev;
+struct napi_struct napi;
+
  /* must be last */
  u8 drv_priv[0] __aligned(sizeof(void *));
  };
diff --git a/drivers/net/wireless/ath/ath10k/htt.h 
b/drivers/net/wireless/ath/ath10k/htt.h

index 430a83e142aa..98c14247021b 100644
--- a/drivers/net/wireless/ath/ath10k/htt.h
+++ b/drivers/net/wireless/ath/ath10k/htt.h
@@ -1665,7 +1665,6 @@ struct ath10k_htt {
/* This is used to group tx/rx completions separately and 
process them

   * in batches to reduce cache stal