New upstream version 17.11.4
[deb_dpdk.git] / drivers / net / thunderx / nicvf_rxtx.c
index 9d69cf4..06cbc46 100644 (file)
@@ -190,12 +190,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;
 }
 
@@ -246,12 +248,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;
 }