[v2] net/thunderx: avoid sq door bell writes on zero packets
diff mbox series

Message ID 1531297476-4604-1-git-send-email-kkokkilagadda@caviumnetworks.com
State Accepted, archived
Delegated to: Ferruh Yigit
Headers show
Series
  • [v2] net/thunderx: avoid sq door bell writes on zero packets
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, 8:24 a.m. UTC
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")
Cc: stable@dpdk.org

Signed-off-by: Kiran Kumar <kkokkilagadda@caviumnetworks.com>
---
 v2 Changes:
 - changed summery and description.
 - added same optimization to nicvf_xmit_pkts_multiseg

 drivers/net/thunderx/nicvf_rxtx.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

--
2.7.4

Comments

Jerin Jacob July 11, 2018, 9:05 a.m. UTC | #1
-----Original Message-----
> Date: Wed, 11 Jul 2018 13:54:36 +0530
> From: Kiran Kumar <kkokkilagadda@caviumnetworks.com>
> To: jerin.jacob@caviumnetworks.com, maciej.czekaj@caviumnetworks.com,
>  ferruh.yigit@intel.com
> Cc: dev@dpdk.org, Kiran Kumar <kkokkilagadda@caviumnetworks.com>,
>  stable@dpdk.org
> Subject: [dpdk-dev] [PATCH v2] net/thunderx: avoid sq door bell writes on
>  zero packets
> X-Mailer: git-send-email 2.7.4
> 
> 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")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Kiran Kumar <kkokkilagadda@caviumnetworks.com>

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

> ---
>  v2 Changes:
>  - changed summery and description.
>  - added same optimization to nicvf_xmit_pkts_multiseg
> 
>  drivers/net/thunderx/nicvf_rxtx.c | 24 ++++++++++++++----------
>  1 file changed, 14 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/net/thunderx/nicvf_rxtx.c b/drivers/net/thunderx/nicvf_rxtx.c
> index 72305d9..6e075e2 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;
>  }
> 
> @@ -218,12 +220,14 @@ nicvf_xmit_pkts_multiseg(void *tx_queue, struct rte_mbuf **tx_pkts,
>  		}
>  	}
> 
> -	sq->tail = tail;
> -	sq->xmit_bufs += used_bufs;
> -	rte_wmb();
> +	if (likely(used_desc)) {
> +		sq->tail = tail;
> +		sq->xmit_bufs += used_bufs;
> +		rte_wmb();
> 
> -	/* Inform HW to xmit the packets */
> -	nicvf_addr_write(sq->sq_door, used_desc);
> +		/* Inform HW to xmit the packets */
> +		nicvf_addr_write(sq->sq_door, used_desc);
> +	}
>  	return i;
>  }
> 
> --
> 2.7.4
>
Yigit, Ferruh July 18, 2018, 9:41 a.m. UTC | #2
On 7/11/2018 10:05 AM, Jerin Jacob wrote:
> -----Original Message-----
>> Date: Wed, 11 Jul 2018 13:54:36 +0530
>> From: Kiran Kumar <kkokkilagadda@caviumnetworks.com>
>> To: jerin.jacob@caviumnetworks.com, maciej.czekaj@caviumnetworks.com,
>>  ferruh.yigit@intel.com
>> Cc: dev@dpdk.org, Kiran Kumar <kkokkilagadda@caviumnetworks.com>,
>>  stable@dpdk.org
>> Subject: [dpdk-dev] [PATCH v2] net/thunderx: avoid sq door bell writes on
>>  zero packets
>> X-Mailer: git-send-email 2.7.4
>>
>> 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")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Kiran Kumar <kkokkilagadda@caviumnetworks.com>
> 
> Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>

Applied to dpdk-next-net/master, thanks.

Patch
diff mbox series

diff --git a/drivers/net/thunderx/nicvf_rxtx.c b/drivers/net/thunderx/nicvf_rxtx.c
index 72305d9..6e075e2 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;
 }

@@ -218,12 +220,14 @@  nicvf_xmit_pkts_multiseg(void *tx_queue, struct rte_mbuf **tx_pkts,
 		}
 	}

-	sq->tail = tail;
-	sq->xmit_bufs += used_bufs;
-	rte_wmb();
+	if (likely(used_desc)) {
+		sq->tail = tail;
+		sq->xmit_bufs += used_bufs;
+		rte_wmb();

-	/* Inform HW to xmit the packets */
-	nicvf_addr_write(sq->sq_door, used_desc);
+		/* Inform HW to xmit the packets */
+		nicvf_addr_write(sq->sq_door, used_desc);
+	}
 	return i;
 }