From: Jakub Palider Date: Sat, 29 Oct 2016 01:06:15 +0000 (+0200) Subject: net/ena: check for free buffers prior Tx X-Git-Tag: spdx-start~5368 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=b66b6e72bb4db64994fea4ecf77b3b3e7307d5d7;p=dpdk.git net/ena: check for free buffers prior Tx Signed-off-by: Tal Avraham Signed-off-by: Jakub Palider --- diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index adf94f2461..ab9a178f72 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -1583,7 +1583,7 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, struct ena_tx_buffer *tx_info; struct ena_com_buf *ebuf; uint16_t rc, req_id, total_tx_descs = 0; - uint16_t sent_idx = 0; + uint16_t sent_idx = 0, empty_tx_reqs; int nb_hw_desc; /* Check adapter state */ @@ -1593,6 +1593,10 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, return 0; } + empty_tx_reqs = ring_size - (next_to_use - next_to_clean); + if (nb_pkts > empty_tx_reqs) + nb_pkts = empty_tx_reqs; + for (sent_idx = 0; sent_idx < nb_pkts; sent_idx++) { mbuf = tx_pkts[sent_idx];