From: Kiran Kumar Date: Wed, 11 Jul 2018 08:24:36 +0000 (+0530) Subject: net/thunderx: avoid sq door bell write on zero packet X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=47636efe878dd8885bb47b142765c9ccae6babe3;p=dpdk.git net/thunderx: avoid sq door bell write on zero packet 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 Acked-by: Jerin Jacob --- diff --git a/drivers/net/thunderx/nicvf_rxtx.c b/drivers/net/thunderx/nicvf_rxtx.c index 72305d9d2a..6e075e23cb 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; }