Skip to content

Commit

Permalink
netdev-dpdk: Keep calling rte_eth_tx_burst() until it returns 0
Browse files Browse the repository at this point in the history
rte_eth_tx_burst() _should_ transmit every packet that it is passed unless the
queue is full. Nontheless some implementation of rte_eth_tx_burst (e.g.
ixgbe_xmit_pkts_vec()) does not transmit more than a fixed number (32) of
packets at a time.

With this commit we assume that there's an error only if rte_eth_tx_burst
returns 0.

Signed-off-by: Daniele Di Proietto <[email protected]>
Acked-by: Pravin B Shelar <[email protected]>
  • Loading branch information
ddiproietto authored and Pravin B Shelar committed Aug 13, 2014
1 parent d731058 commit 1304f1f
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions lib/netdev-dpdk.c
Original file line number Diff line number Diff line change
Expand Up @@ -621,9 +621,20 @@ static inline void
dpdk_queue_flush__(struct netdev_dpdk *dev, int qid)
{
struct dpdk_tx_queue *txq = &dev->tx_q[qid];
uint32_t nb_tx;
uint32_t nb_tx = 0;

while (nb_tx != txq->count) {
uint32_t ret;

ret = rte_eth_tx_burst(dev->port_id, qid, txq->burst_pkts + nb_tx,
txq->count - nb_tx);
if (!ret) {
break;
}

nb_tx += ret;
}

nb_tx = rte_eth_tx_burst(dev->port_id, qid, txq->burst_pkts, txq->count);
if (OVS_UNLIKELY(nb_tx != txq->count)) {
/* free buffers, which we couldn't transmit, one at a time (each
* packet could come from a different mempool) */
Expand All @@ -632,7 +643,11 @@ dpdk_queue_flush__(struct netdev_dpdk *dev, int qid)
for (i = nb_tx; i < txq->count; i++) {
rte_pktmbuf_free_seg(txq->burst_pkts[i]);
}
ovs_mutex_lock(&dev->mutex);
dev->stats.tx_dropped += txq->count-nb_tx;
ovs_mutex_unlock(&dev->mutex);
}

txq->count = 0;
txq->tsc = rte_get_timer_cycles();
}
Expand Down

0 comments on commit 1304f1f

Please sign in to comment.