netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net PATCH v3] octeontx2-pf: consider both Rx and Tx packet stats for adaptive interrupt coalescing
@ 2023-12-01  5:33 Suman Ghosh
  2023-12-01 10:44 ` Wojciech Drewek
  2023-12-05  2:40 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Suman Ghosh @ 2023-12-01  5:33 UTC (permalink / raw)
  To: sgoutham, gakula, sbhatta, hkelam, lcherian, jerinj, davem,
	edumazet, kuba, pabeni, netdev, linux-kernel, horms, naveenm
  Cc: Suman Ghosh

From: Naveen Mamindlapalli <naveenm@marvell.com>

The current adaptive interrupt coalescing code updates only rx
packet stats for dim algorithm. This patch also updates tx packet
stats which will be useful when there is only tx traffic.
Also moved configuring hardware adaptive interrupt setting to
driver dim callback.

Fixes: 6e144b47f560 ("octeontx2-pf: Add support for adaptive interrupt coalescing")
Signed-off-by: Naveen Mamindlapalli <naveenm@marvell.com>
Signed-off-by: Suman Ghosh <sumang@marvell.com>
---
v3 changes:
- Updated signed-off-by signature.

v2 changes:
- Missed adding the fixes tag in v1. Added the same in v2.

 .../ethernet/marvell/octeontx2/nic/otx2_pf.c  |  9 +++++++++
 .../marvell/octeontx2/nic/otx2_txrx.c         | 20 +++++++++----------
 2 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
index ba95ac913274..6c0e0e2c235b 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
@@ -1685,6 +1685,14 @@ static void otx2_do_set_rx_mode(struct otx2_nic *pf)
 	mutex_unlock(&pf->mbox.lock);
 }
 
+static void otx2_set_irq_coalesce(struct otx2_nic *pfvf)
+{
+	int cint;
+
+	for (cint = 0; cint < pfvf->hw.cint_cnt; cint++)
+		otx2_config_irq_coalescing(pfvf, cint);
+}
+
 static void otx2_dim_work(struct work_struct *w)
 {
 	struct dim_cq_moder cur_moder;
@@ -1700,6 +1708,7 @@ static void otx2_dim_work(struct work_struct *w)
 		CQ_TIMER_THRESH_MAX : cur_moder.usec;
 	pfvf->hw.cq_ecount_wait = (cur_moder.pkts > NAPI_POLL_WEIGHT) ?
 		NAPI_POLL_WEIGHT : cur_moder.pkts;
+	otx2_set_irq_coalesce(pfvf);
 	dim->state = DIM_START_MEASURE;
 }
 
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
index 6ee15f3c25ed..4d519ea833b2 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
@@ -512,11 +512,18 @@ static void otx2_adjust_adaptive_coalese(struct otx2_nic *pfvf, struct otx2_cq_p
 {
 	struct dim_sample dim_sample;
 	u64 rx_frames, rx_bytes;
+	u64 tx_frames, tx_bytes;
 
 	rx_frames = OTX2_GET_RX_STATS(RX_BCAST) + OTX2_GET_RX_STATS(RX_MCAST) +
 		OTX2_GET_RX_STATS(RX_UCAST);
 	rx_bytes = OTX2_GET_RX_STATS(RX_OCTS);
-	dim_update_sample(pfvf->napi_events, rx_frames, rx_bytes, &dim_sample);
+	tx_bytes = OTX2_GET_TX_STATS(TX_OCTS);
+	tx_frames = OTX2_GET_TX_STATS(TX_UCAST);
+
+	dim_update_sample(pfvf->napi_events,
+			  rx_frames + tx_frames,
+			  rx_bytes + tx_bytes,
+			  &dim_sample);
 	net_dim(&cq_poll->dim, dim_sample);
 }
 
@@ -558,16 +565,9 @@ int otx2_napi_handler(struct napi_struct *napi, int budget)
 		if (pfvf->flags & OTX2_FLAG_INTF_DOWN)
 			return workdone;
 
-		/* Check for adaptive interrupt coalesce */
-		if (workdone != 0 &&
-		    ((pfvf->flags & OTX2_FLAG_ADPTV_INT_COAL_ENABLED) ==
-		     OTX2_FLAG_ADPTV_INT_COAL_ENABLED)) {
-			/* Adjust irq coalese using net_dim */
+		/* Adjust irq coalese using net_dim */
+		if (pfvf->flags & OTX2_FLAG_ADPTV_INT_COAL_ENABLED)
 			otx2_adjust_adaptive_coalese(pfvf, cq_poll);
-			/* Update irq coalescing */
-			for (i = 0; i < pfvf->hw.cint_cnt; i++)
-				otx2_config_irq_coalescing(pfvf, i);
-		}
 
 		if (unlikely(!filled_cnt)) {
 			struct refill_work *work;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [net PATCH v3] octeontx2-pf: consider both Rx and Tx packet stats for adaptive interrupt coalescing
  2023-12-01  5:33 [net PATCH v3] octeontx2-pf: consider both Rx and Tx packet stats for adaptive interrupt coalescing Suman Ghosh
@ 2023-12-01 10:44 ` Wojciech Drewek
  2023-12-05  2:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Wojciech Drewek @ 2023-12-01 10:44 UTC (permalink / raw)
  To: Suman Ghosh, sgoutham, gakula, sbhatta, hkelam, lcherian, jerinj,
	davem, edumazet, kuba, pabeni, netdev, linux-kernel, horms,
	naveenm



On 01.12.2023 06:33, Suman Ghosh wrote:
> From: Naveen Mamindlapalli <naveenm@marvell.com>
> 
> The current adaptive interrupt coalescing code updates only rx
> packet stats for dim algorithm. This patch also updates tx packet
> stats which will be useful when there is only tx traffic.
> Also moved configuring hardware adaptive interrupt setting to
> driver dim callback.
> 
> Fixes: 6e144b47f560 ("octeontx2-pf: Add support for adaptive interrupt coalescing")
> Signed-off-by: Naveen Mamindlapalli <naveenm@marvell.com>
> Signed-off-by: Suman Ghosh <sumang@marvell.com>
> ---

Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>

> v3 changes:
> - Updated signed-off-by signature.
> 
> v2 changes:
> - Missed adding the fixes tag in v1. Added the same in v2.
> 
>  .../ethernet/marvell/octeontx2/nic/otx2_pf.c  |  9 +++++++++
>  .../marvell/octeontx2/nic/otx2_txrx.c         | 20 +++++++++----------
>  2 files changed, 19 insertions(+), 10 deletions(-)
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [net PATCH v3] octeontx2-pf: consider both Rx and Tx packet stats for adaptive interrupt coalescing
  2023-12-01  5:33 [net PATCH v3] octeontx2-pf: consider both Rx and Tx packet stats for adaptive interrupt coalescing Suman Ghosh
  2023-12-01 10:44 ` Wojciech Drewek
@ 2023-12-05  2:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-12-05  2:40 UTC (permalink / raw)
  To: Suman Ghosh
  Cc: sgoutham, gakula, sbhatta, hkelam, lcherian, jerinj, davem,
	edumazet, kuba, pabeni, netdev, linux-kernel, horms, naveenm

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Fri, 1 Dec 2023 11:03:30 +0530 you wrote:
> From: Naveen Mamindlapalli <naveenm@marvell.com>
> 
> The current adaptive interrupt coalescing code updates only rx
> packet stats for dim algorithm. This patch also updates tx packet
> stats which will be useful when there is only tx traffic.
> Also moved configuring hardware adaptive interrupt setting to
> driver dim callback.
> 
> [...]

Here is the summary with links:
  - [net,v3] octeontx2-pf: consider both Rx and Tx packet stats for adaptive interrupt coalescing
    https://git.kernel.org/netdev/net/c/adbf100fc470

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-12-05  2:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-01  5:33 [net PATCH v3] octeontx2-pf: consider both Rx and Tx packet stats for adaptive interrupt coalescing Suman Ghosh
2023-12-01 10:44 ` Wojciech Drewek
2023-12-05  2:40 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).