DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] i40e: Fix the clean up function for i40e, the DD bits are multiplex with descriptor type field. so cannot use "not zero" as the rule for the completion of Tx descriptor
@ 2015-07-03 17:11 Zhe Tao
  2015-07-08  9:29 ` [dpdk-dev] [PATCH v2] i40e:Fix the Description Done check mechanism for i40e Zhe Tao
  2015-07-16 19:20 ` [dpdk-dev] [PATCH] i40e: Fix the clean up function for i40e, the DD bits are multiplex with descriptor type field. so cannot use "not zero" as the rule for the completion of Tx descriptor Zhang, Helin
  0 siblings, 2 replies; 6+ messages in thread
From: Zhe Tao @ 2015-07-03 17:11 UTC (permalink / raw)
  To: dev

If the descriptor in the position desc_to_clean_to is the context descriptor its type will be 0x1, so using the not expression, the device driver will consider the descriptor has been complete for transmission even its DTYPE field is still 0x1 which means NIC has't finished the operation on this descriptor. 

Signed-off-by: Zhe Tao <zhe.tao@intel.com>
---
 drivers/net/i40e/i40e_rxtx.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index 2de0ac4..5d33f62 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -574,8 +574,9 @@ i40e_xmit_cleanup(struct i40e_tx_queue *txq)
 		desc_to_clean_to = (uint16_t)(desc_to_clean_to - nb_tx_desc);
 
 	desc_to_clean_to = sw_ring[desc_to_clean_to].last_id;
-	if (!(txd[desc_to_clean_to].cmd_type_offset_bsz &
-		rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE))) {
+	if ((txd[desc_to_clean_to].cmd_type_offset_bsz &
+		rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) !=
+		rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE)) {
 		PMD_TX_FREE_LOG(DEBUG, "TX descriptor %4u is not done "
 			"(port=%d queue=%d)", desc_to_clean_to,
 				txq->port_id, txq->queue_id);
-- 
1.8.4.2

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

* [dpdk-dev] [PATCH v2] i40e:Fix the Description Done check mechanism for i40e
  2015-07-03 17:11 [dpdk-dev] [PATCH] i40e: Fix the clean up function for i40e, the DD bits are multiplex with descriptor type field. so cannot use "not zero" as the rule for the completion of Tx descriptor Zhe Tao
@ 2015-07-08  9:29 ` Zhe Tao
  2015-07-09  2:58   ` [dpdk-dev] [PATCH v3] i40e:Fix the Descriptor " Zhe Tao
  2015-07-16 19:20 ` [dpdk-dev] [PATCH] i40e: Fix the clean up function for i40e, the DD bits are multiplex with descriptor type field. so cannot use "not zero" as the rule for the completion of Tx descriptor Zhang, Helin
  1 sibling, 1 reply; 6+ messages in thread
From: Zhe Tao @ 2015-07-08  9:29 UTC (permalink / raw)
  To: dev

If the descriptor the device derive is handling is the context descriptor its type will be 0x1, so using the not expression, the device driver will consider the descriptor has been completed for transmission even its DD field is still 0x1 which means NIC has't finished the operation on this descriptor. 

Signed-off-by: Zhe Tao <zhe.tao@intel.com>
---
 drivers/net/i40e/i40e_fdir.c |  3 ++-
 drivers/net/i40e/i40e_rxtx.c | 10 ++++++----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index 4bf98d0..f3cb757 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -1110,7 +1110,8 @@ i40e_fdir_filter_programming(struct i40e_pf *pf,
 
 	for (i = 0; i < I40E_FDIR_WAIT_COUNT; i++) {
 		rte_delay_us(I40E_FDIR_WAIT_INTERVAL_US);
-		if (txdp->cmd_type_offset_bsz &
+		if ((txdp->cmd_type_offset_bsz &
+				rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) ==
 				rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE))
 			break;
 	}
diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index 2de0ac4..7c0c684 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -574,8 +574,9 @@ i40e_xmit_cleanup(struct i40e_tx_queue *txq)
 		desc_to_clean_to = (uint16_t)(desc_to_clean_to - nb_tx_desc);
 
 	desc_to_clean_to = sw_ring[desc_to_clean_to].last_id;
-	if (!(txd[desc_to_clean_to].cmd_type_offset_bsz &
-		rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE))) {
+	if ((txd[desc_to_clean_to].cmd_type_offset_bsz &
+			rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) !=
+			rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE)) {
 		PMD_TX_FREE_LOG(DEBUG, "TX descriptor %4u is not done "
 			"(port=%d queue=%d)", desc_to_clean_to,
 				txq->port_id, txq->queue_id);
@@ -1431,8 +1432,9 @@ i40e_tx_free_bufs(struct i40e_tx_queue *txq)
 	struct i40e_tx_entry *txep;
 	uint16_t i;
 
-	if (!(txq->tx_ring[txq->tx_next_dd].cmd_type_offset_bsz &
-			rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE)))
+	if ((txq->tx_ring[txq->tx_next_dd].cmd_type_offset_bsz &
+			rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) !=
+			rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE))
 		return 0;
 
 	txep = &(txq->sw_ring[txq->tx_next_dd - (txq->tx_rs_thresh - 1)]);
-- 
1.8.4.2

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

* [dpdk-dev] [PATCH v3] i40e:Fix the Descriptor Done check mechanism for i40e
  2015-07-08  9:29 ` [dpdk-dev] [PATCH v2] i40e:Fix the Description Done check mechanism for i40e Zhe Tao
@ 2015-07-09  2:58   ` Zhe Tao
  2015-07-09  3:31     ` Wu, Jingjing
  0 siblings, 1 reply; 6+ messages in thread
From: Zhe Tao @ 2015-07-09  2:58 UTC (permalink / raw)
  To: dev

If a descriptor the device drive is handling is the context descriptor, its type value will be 0x1.
When using the not operator ! to do the conditional check, if the expression value is zero, the device driver will consider the transaction for this descriptor has been completed,
even its DD field is still 0x1 which means NIC has not finished the operation on this descriptor. 
Use the 0xF to check the DD status to avoid the above issue happens.

Signed-off-by: Zhe Tao <zhe.tao@intel.com>
---

Patch v3 changes:
-Fix typo for the patch

Patch v2 changes:
-Fix the DD check mechanism for other functions (besides the i40e_xmit_cleanup) which use the DD bits to do conditional check

changes:
-Fix the DD check mechanism for i40e_xmit_cleanup

 drivers/net/i40e/i40e_fdir.c |  3 ++-
 drivers/net/i40e/i40e_rxtx.c | 10 ++++++----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index 4bf98d0..f3cb757 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -1110,7 +1110,8 @@ i40e_fdir_filter_programming(struct i40e_pf *pf,
 
 	for (i = 0; i < I40E_FDIR_WAIT_COUNT; i++) {
 		rte_delay_us(I40E_FDIR_WAIT_INTERVAL_US);
-		if (txdp->cmd_type_offset_bsz &
+		if ((txdp->cmd_type_offset_bsz &
+				rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) ==
 				rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE))
 			break;
 	}
diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index 2de0ac4..7c0c684 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -574,8 +574,9 @@ i40e_xmit_cleanup(struct i40e_tx_queue *txq)
 		desc_to_clean_to = (uint16_t)(desc_to_clean_to - nb_tx_desc);
 
 	desc_to_clean_to = sw_ring[desc_to_clean_to].last_id;
-	if (!(txd[desc_to_clean_to].cmd_type_offset_bsz &
-		rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE))) {
+	if ((txd[desc_to_clean_to].cmd_type_offset_bsz &
+			rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) !=
+			rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE)) {
 		PMD_TX_FREE_LOG(DEBUG, "TX descriptor %4u is not done "
 			"(port=%d queue=%d)", desc_to_clean_to,
 				txq->port_id, txq->queue_id);
@@ -1431,8 +1432,9 @@ i40e_tx_free_bufs(struct i40e_tx_queue *txq)
 	struct i40e_tx_entry *txep;
 	uint16_t i;
 
-	if (!(txq->tx_ring[txq->tx_next_dd].cmd_type_offset_bsz &
-			rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE)))
+	if ((txq->tx_ring[txq->tx_next_dd].cmd_type_offset_bsz &
+			rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) !=
+			rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE))
 		return 0;
 
 	txep = &(txq->sw_ring[txq->tx_next_dd - (txq->tx_rs_thresh - 1)]);
-- 
1.8.4.2

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

* Re: [dpdk-dev] [PATCH v3] i40e:Fix the Descriptor Done check mechanism for i40e
  2015-07-09  2:58   ` [dpdk-dev] [PATCH v3] i40e:Fix the Descriptor " Zhe Tao
@ 2015-07-09  3:31     ` Wu, Jingjing
  2015-07-10 16:56       ` Thomas Monjalon
  0 siblings, 1 reply; 6+ messages in thread
From: Wu, Jingjing @ 2015-07-09  3:31 UTC (permalink / raw)
  To: Tao, Zhe, dev

Acked-by: Jingjing Wu <jingjing.wu@intel.com>

> -----Original Message-----
> From: Tao, Zhe
> Sent: Thursday, July 09, 2015 10:58 AM
> To: dev@dpdk.org
> Cc: Tao, Zhe; Wu, Jingjing
> Subject: [PATCH v3] i40e:Fix the Descriptor Done check mechanism for i40e
> 
> If a descriptor the device drive is handling is the context descriptor, its type
> value will be 0x1.
> When using the not operator ! to do the conditional check, if the expression
> value is zero, the device driver will consider the transaction for this descriptor
> has been completed, even its DD field is still 0x1 which means NIC has not
> finished the operation on this descriptor.
> Use the 0xF to check the DD status to avoid the above issue happens.
> 
> Signed-off-by: Zhe Tao <zhe.tao@intel.com>
> ---
> 
> Patch v3 changes:
> -Fix typo for the patch
> 
> Patch v2 changes:
> -Fix the DD check mechanism for other functions (besides the
> i40e_xmit_cleanup) which use the DD bits to do conditional check
> 
> changes:
> -Fix the DD check mechanism for i40e_xmit_cleanup
> 
>  drivers/net/i40e/i40e_fdir.c |  3 ++-
>  drivers/net/i40e/i40e_rxtx.c | 10 ++++++----
>  2 files changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index
> 4bf98d0..f3cb757 100644
> --- a/drivers/net/i40e/i40e_fdir.c
> +++ b/drivers/net/i40e/i40e_fdir.c
> @@ -1110,7 +1110,8 @@ i40e_fdir_filter_programming(struct i40e_pf *pf,
> 
>  	for (i = 0; i < I40E_FDIR_WAIT_COUNT; i++) {
>  		rte_delay_us(I40E_FDIR_WAIT_INTERVAL_US);
> -		if (txdp->cmd_type_offset_bsz &
> +		if ((txdp->cmd_type_offset_bsz &
> +
> 	rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) ==
> 
> 	rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE))
>  			break;
>  	}
> diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index
> 2de0ac4..7c0c684 100644
> --- a/drivers/net/i40e/i40e_rxtx.c
> +++ b/drivers/net/i40e/i40e_rxtx.c
> @@ -574,8 +574,9 @@ i40e_xmit_cleanup(struct i40e_tx_queue *txq)
>  		desc_to_clean_to = (uint16_t)(desc_to_clean_to -
> nb_tx_desc);
> 
>  	desc_to_clean_to = sw_ring[desc_to_clean_to].last_id;
> -	if (!(txd[desc_to_clean_to].cmd_type_offset_bsz &
> -		rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE))) {
> +	if ((txd[desc_to_clean_to].cmd_type_offset_bsz &
> +
> 	rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) !=
> +
> 	rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE)) {
>  		PMD_TX_FREE_LOG(DEBUG, "TX descriptor %4u is not done
> "
>  			"(port=%d queue=%d)", desc_to_clean_to,
>  				txq->port_id, txq->queue_id);
> @@ -1431,8 +1432,9 @@ i40e_tx_free_bufs(struct i40e_tx_queue *txq)
>  	struct i40e_tx_entry *txep;
>  	uint16_t i;
> 
> -	if (!(txq->tx_ring[txq->tx_next_dd].cmd_type_offset_bsz &
> -
> 	rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE)))
> +	if ((txq->tx_ring[txq->tx_next_dd].cmd_type_offset_bsz &
> +
> 	rte_cpu_to_le_64(I40E_TXD_QW1_DTYPE_MASK)) !=
> +
> 	rte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE))
>  		return 0;
> 
>  	txep = &(txq->sw_ring[txq->tx_next_dd - (txq->tx_rs_thresh - 1)]);
> --
> 1.8.4.2

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

* Re: [dpdk-dev] [PATCH v3] i40e:Fix the Descriptor Done check mechanism for i40e
  2015-07-09  3:31     ` Wu, Jingjing
@ 2015-07-10 16:56       ` Thomas Monjalon
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Monjalon @ 2015-07-10 16:56 UTC (permalink / raw)
  To: Tao, Zhe; +Cc: dev

> > If a descriptor the device drive is handling is the context descriptor, its type
> > value will be 0x1.
> > When using the not operator ! to do the conditional check, if the expression
> > value is zero, the device driver will consider the transaction for this descriptor
> > has been completed, even its DD field is still 0x1 which means NIC has not
> > finished the operation on this descriptor.
> > Use the 0xF to check the DD status to avoid the above issue happens.
> > 
> > Signed-off-by: Zhe Tao <zhe.tao@intel.com>
> Acked-by: Jingjing Wu <jingjing.wu@intel.com>

Applied, thanks

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

* Re: [dpdk-dev] [PATCH] i40e: Fix the clean up function for i40e, the DD bits are multiplex with descriptor type field. so cannot use "not zero" as the rule for the completion of Tx descriptor
  2015-07-03 17:11 [dpdk-dev] [PATCH] i40e: Fix the clean up function for i40e, the DD bits are multiplex with descriptor type field. so cannot use "not zero" as the rule for the completion of Tx descriptor Zhe Tao
  2015-07-08  9:29 ` [dpdk-dev] [PATCH v2] i40e:Fix the Description Done check mechanism for i40e Zhe Tao
@ 2015-07-16 19:20 ` Zhang, Helin
  1 sibling, 0 replies; 6+ messages in thread
From: Zhang, Helin @ 2015-07-16 19:20 UTC (permalink / raw)
  To: Tao, Zhe, dev



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Zhe Tao
> Sent: Friday, July 3, 2015 10:12 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] i40e: Fix the clean up function for i40e, the DD bits
> are multiplex with descriptor type field. so cannot use "not zero" as the rule for
> the completion of Tx descriptor
> 
> If the descriptor in the position desc_to_clean_to is the context descriptor its
> type will be 0x1, so using the not expression, the device driver will consider the
> descriptor has been complete for transmission even its DTYPE field is still 0x1
> which means NIC has't finished the operation on this descriptor.
> 
> Signed-off-by: Zhe Tao <zhe.tao@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>

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

end of thread, other threads:[~2015-07-16 19:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-03 17:11 [dpdk-dev] [PATCH] i40e: Fix the clean up function for i40e, the DD bits are multiplex with descriptor type field. so cannot use "not zero" as the rule for the completion of Tx descriptor Zhe Tao
2015-07-08  9:29 ` [dpdk-dev] [PATCH v2] i40e:Fix the Description Done check mechanism for i40e Zhe Tao
2015-07-09  2:58   ` [dpdk-dev] [PATCH v3] i40e:Fix the Descriptor " Zhe Tao
2015-07-09  3:31     ` Wu, Jingjing
2015-07-10 16:56       ` Thomas Monjalon
2015-07-16 19:20 ` [dpdk-dev] [PATCH] i40e: Fix the clean up function for i40e, the DD bits are multiplex with descriptor type field. so cannot use "not zero" as the rule for the completion of Tx descriptor Zhang, Helin

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