struct txq *txq = (struct txq *)dpdk_txq;
unsigned int elts_head = txq->elts_head;
const unsigned int elts_n = txq->elts_n;
- unsigned int elts_comp = 0;
unsigned int bytes_sent = 0;
unsigned int i;
unsigned int max;
assert(max <= elts_n);
/* Always leave one free entry in the ring. */
--max;
- if (max == 0)
- return 0;
if (max > pkts_n)
max = pkts_n;
for (i = 0; (i != max); ++i) {
sq->head += nr_txbbs;
elt->buf = buf;
bytes_sent += buf->pkt_len;
- ++elts_comp;
elts_head = elts_head_next;
}
/* Take a shortcut if nothing must be sent. */
/* Ring QP doorbell. */
rte_write32(txq->msq.doorbell_qpn, txq->msq.db);
txq->elts_head = elts_head;
- txq->elts_comp += elts_comp;
+ txq->elts_comp += i;
return i;
}