net/thunderx: Block sq door writes on zero pkts
diff mbox series

Message ID 1531293723-930-1-git-send-email-kkokkilagadda@caviumnetworks.com
State Superseded, archived
Headers show
Series
  • net/thunderx: Block sq door writes on zero pkts
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Kiran Kumar July 11, 2018, 7:22 a.m. UTC
With current code, we are performing sq door writes even with 0 pkts.
this will create pressure on register bus. This patch will block these
writes.

Fixes: 1c421f18e0 ("net/thunderx: add single and multi-segment Tx")

Signed-off-by: Kiran Kumar <kkokkilagadda@caviumnetworks.com>
---
 drivers/net/thunderx/nicvf_rxtx.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

Comments

Jerin Jacob July 11, 2018, 7:37 a.m. UTC | #1
-----Original Message-----
> Date: Wed, 11 Jul 2018 12:52:03 +0530
> From: Kiran Kumar <kkokkilagadda@caviumnetworks.com>
> To: dev@dpdk.org
> Cc: jerin.jacob@caviumnetworks.com, maciej.czekaj@caviumnetworks.com, Kiran
>  Kumar <kkokkilagadda@caviumnetworks.com>
> Subject: [dpdk-dev] [PATCH] net/thunderx: Block sq door writes on zero pkts
> X-Mailer: git-send-email 2.7.4

Use small letter to start the comment.(s/Block/block)

I think, we can change the subject to "avoid sq door bell writes on zero packet"

> 
> With current code, we are performing sq door writes even with 0 pkts.
> this will create pressure on register bus. This patch will block these
> writes.

Could rename to:

Avoid sq door bell write on zero packet case to reduce additional traffic
on register bus.

> 
> Fixes: 1c421f18e0 ("net/thunderx: add single and multi-segment Tx")

add
Cc: stable@dpdk.org

> 
> Signed-off-by: Kiran Kumar <kkokkilagadda@caviumnetworks.com>
> ---
>  drivers/net/thunderx/nicvf_rxtx.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/thunderx/nicvf_rxtx.c b/drivers/net/thunderx/nicvf_rxtx.c
> index 72305d9..8075a8e 100644
> --- a/drivers/net/thunderx/nicvf_rxtx.c
> +++ b/drivers/net/thunderx/nicvf_rxtx.c
> @@ -162,12 +162,14 @@ nicvf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
>  		free_desc -= TX_DESC_PER_PKT;
>  	}
>  
> -	sq->tail = tail;
> -	sq->xmit_bufs += i;
> -	rte_wmb();
> +	if (likely(i)) {
> +		sq->tail = tail;
> +		sq->xmit_bufs += i;
> +		rte_wmb();
>  
> -	/* Inform HW to xmit the packets */
> -	nicvf_addr_write(sq->sq_door, i * TX_DESC_PER_PKT);
> +		/* Inform HW to xmit the packets */
> +		nicvf_addr_write(sq->sq_door, i * TX_DESC_PER_PKT);
> +	}


Please add same logic for nicvf_xmit_pkts_multiseg function.

With above changes:
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>



>  	return i;
>  }
>  
> -- 
> 2.7.4
>

Patch
diff mbox series

diff --git a/drivers/net/thunderx/nicvf_rxtx.c b/drivers/net/thunderx/nicvf_rxtx.c
index 72305d9..8075a8e 100644
--- a/drivers/net/thunderx/nicvf_rxtx.c
+++ b/drivers/net/thunderx/nicvf_rxtx.c
@@ -162,12 +162,14 @@  nicvf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 		free_desc -= TX_DESC_PER_PKT;
 	}
 
-	sq->tail = tail;
-	sq->xmit_bufs += i;
-	rte_wmb();
+	if (likely(i)) {
+		sq->tail = tail;
+		sq->xmit_bufs += i;
+		rte_wmb();
 
-	/* Inform HW to xmit the packets */
-	nicvf_addr_write(sq->sq_door, i * TX_DESC_PER_PKT);
+		/* Inform HW to xmit the packets */
+		nicvf_addr_write(sq->sq_door, i * TX_DESC_PER_PKT);
+	}
 	return i;
 }