DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/thunderx: Block sq door writes on zero pkts
@ 2018-07-11  7:22 Kiran Kumar
  2018-07-11  7:37 ` Jerin Jacob
  2018-07-11  8:24 ` [dpdk-dev] [PATCH v2] net/thunderx: avoid sq door bell writes on zero packets Kiran Kumar
  0 siblings, 2 replies; 5+ messages in thread
From: Kiran Kumar @ 2018-07-11  7:22 UTC (permalink / raw)
  To: dev; +Cc: jerin.jacob, maciej.czekaj, Kiran Kumar

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(-)

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;
 }
 
-- 
2.7.4

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

* Re: [dpdk-dev] [PATCH] net/thunderx: Block sq door writes on zero pkts
  2018-07-11  7:22 [dpdk-dev] [PATCH] net/thunderx: Block sq door writes on zero pkts Kiran Kumar
@ 2018-07-11  7:37 ` Jerin Jacob
  2018-07-11  8:24 ` [dpdk-dev] [PATCH v2] net/thunderx: avoid sq door bell writes on zero packets Kiran Kumar
  1 sibling, 0 replies; 5+ messages in thread
From: Jerin Jacob @ 2018-07-11  7:37 UTC (permalink / raw)
  To: Kiran Kumar; +Cc: dev, maciej.czekaj

-----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
> 

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

* [dpdk-dev] [PATCH v2] net/thunderx: avoid sq door bell writes on zero packets
  2018-07-11  7:22 [dpdk-dev] [PATCH] net/thunderx: Block sq door writes on zero pkts Kiran Kumar
  2018-07-11  7:37 ` Jerin Jacob
@ 2018-07-11  8:24 ` Kiran Kumar
  2018-07-11  9:05   ` Jerin Jacob
  1 sibling, 1 reply; 5+ messages in thread
From: Kiran Kumar @ 2018-07-11  8:24 UTC (permalink / raw)
  To: jerin.jacob, maciej.czekaj, ferruh.yigit; +Cc: dev, Kiran Kumar, stable

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(-)

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

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

* Re: [dpdk-dev] [PATCH v2] net/thunderx: avoid sq door bell writes on zero packets
  2018-07-11  8:24 ` [dpdk-dev] [PATCH v2] net/thunderx: avoid sq door bell writes on zero packets Kiran Kumar
@ 2018-07-11  9:05   ` Jerin Jacob
  2018-07-18  9:41     ` Ferruh Yigit
  0 siblings, 1 reply; 5+ messages in thread
From: Jerin Jacob @ 2018-07-11  9:05 UTC (permalink / raw)
  To: Kiran Kumar; +Cc: maciej.czekaj, ferruh.yigit, dev, stable

-----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
> 

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

* Re: [dpdk-dev] [PATCH v2] net/thunderx: avoid sq door bell writes on zero packets
  2018-07-11  9:05   ` Jerin Jacob
@ 2018-07-18  9:41     ` Ferruh Yigit
  0 siblings, 0 replies; 5+ messages in thread
From: Ferruh Yigit @ 2018-07-18  9:41 UTC (permalink / raw)
  To: Jerin Jacob, Kiran Kumar; +Cc: maciej.czekaj, dev, stable

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.

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

end of thread, other threads:[~2018-07-18  9:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-11  7:22 [dpdk-dev] [PATCH] net/thunderx: Block sq door writes on zero pkts Kiran Kumar
2018-07-11  7:37 ` Jerin Jacob
2018-07-11  8:24 ` [dpdk-dev] [PATCH v2] net/thunderx: avoid sq door bell writes on zero packets Kiran Kumar
2018-07-11  9:05   ` Jerin Jacob
2018-07-18  9:41     ` Ferruh Yigit

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).