From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <zhetao@shecgisg004.sh.intel.com>
Received: from mga09.intel.com (mga09.intel.com [134.134.136.24])
 by dpdk.org (Postfix) with ESMTP id CB0762716
 for <dev@dpdk.org>; Fri,  3 Jul 2015 19:11:57 +0200 (CEST)
Received: from fmsmga001.fm.intel.com ([10.253.24.23])
 by orsmga102.jf.intel.com with ESMTP; 03 Jul 2015 10:11:56 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.15,401,1432623600"; d="scan'208";a="740163092"
Received: from shvmail01.sh.intel.com ([10.239.29.42])
 by fmsmga001.fm.intel.com with ESMTP; 03 Jul 2015 10:11:56 -0700
Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com
 [10.239.29.89])
 by shvmail01.sh.intel.com with ESMTP id t63HBr6k016616;
 Sat, 4 Jul 2015 01:11:53 +0800
Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1])
 by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id
 t63HBoc0002713; Sat, 4 Jul 2015 01:11:52 +0800
Received: (from zhetao@localhost)
 by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t63HBob0002709;
 Sat, 4 Jul 2015 01:11:50 +0800
From: Zhe Tao <zhe.tao@intel.com>
To: dev@dpdk.org
Date: Sat,  4 Jul 2015 01:11:47 +0800
Message-Id: <1435943507-2679-1-git-send-email-zhe.tao@intel.com>
X-Mailer: git-send-email 1.7.4.1
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
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 03 Jul 2015 17:11:58 -0000

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