Skip to content

Commit

Permalink
net/iavf: fix Tx done descriptors cleanup
Browse files Browse the repository at this point in the history
[ upstream commit 4e86840 ]

iavf_xmit_pkts() sets tx_tail to the next of last transmitted
Tx descriptor. So the cleanup of Tx done descriptors must be started
from tx_tail, not from the next of tx_tail.
Otherwise rte_eth_tx_done_cleanup() doesn't free the first Tx done mbuf
when tx queue is full.

Fixes: 86e4424 ("net/iavf: cleanup Tx buffers")

Signed-off-by: Aleksandr Miloshenko <a.miloshenko@f5.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
  • Loading branch information
Aleksandr Miloshenko authored and kevintraynor committed Oct 11, 2022
1 parent 246026e commit 30fc18b
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions drivers/net/iavf/iavf_rxtx.c
Expand Up @@ -3060,14 +3060,14 @@ iavf_tx_done_cleanup_full(struct iavf_tx_queue *txq,
uint32_t free_cnt)
{
struct iavf_tx_entry *swr_ring = txq->sw_ring;
uint16_t i, tx_last, tx_id;
uint16_t tx_last, tx_id;
uint16_t nb_tx_free_last;
uint16_t nb_tx_to_clean;
uint32_t pkt_cnt;
uint32_t pkt_cnt = 0;

/* Start free mbuf from the next of tx_tail */
tx_last = txq->tx_tail;
tx_id = swr_ring[tx_last].next_id;
/* Start free mbuf from tx_tail */
tx_id = txq->tx_tail;
tx_last = tx_id;

if (txq->nb_free == 0 && iavf_xmit_cleanup(txq))
return 0;
Expand All @@ -3080,10 +3080,8 @@ iavf_tx_done_cleanup_full(struct iavf_tx_queue *txq,
/* Loop through swr_ring to count the amount of
* freeable mubfs and packets.
*/
for (pkt_cnt = 0; pkt_cnt < free_cnt; ) {
for (i = 0; i < nb_tx_to_clean &&
pkt_cnt < free_cnt &&
tx_id != tx_last; i++) {
while (pkt_cnt < free_cnt) {
do {
if (swr_ring[tx_id].mbuf != NULL) {
rte_pktmbuf_free_seg(swr_ring[tx_id].mbuf);
swr_ring[tx_id].mbuf = NULL;
Expand All @@ -3096,7 +3094,7 @@ iavf_tx_done_cleanup_full(struct iavf_tx_queue *txq,
}

tx_id = swr_ring[tx_id].next_id;
}
} while (--nb_tx_to_clean && pkt_cnt < free_cnt && tx_id != tx_last);

if (txq->rs_thresh > txq->nb_tx_desc -
txq->nb_free || tx_id == tx_last)
Expand Down

0 comments on commit 30fc18b

Please sign in to comment.