From: Zhe Tao Date: Thu, 9 Jul 2015 02:58:08 +0000 (+0800) Subject: i40e: fix check of descriptor done flag X-Git-Tag: spdx-start~8789 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=7eda588164146526d18342e867820c6f8fcb3580;p=dpdk.git i40e: fix check of descriptor done flag 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. Fixes: 4861cde46116 ("i40e: new poll mode driver") Fixes: 05999aab4ca6 ("i40e: add or delete flow director") Signed-off-by: Zhe Tao Acked-by: Jingjing Wu --- diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index 8b81ca3a31..66e5961fbc 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -1128,7 +1128,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 c79160f07e..6daf1dca19 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -600,8 +600,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); @@ -1488,8 +1489,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)]);