From: Xiao Wang Date: Sat, 26 Oct 2019 00:33:22 +0000 (-0400) Subject: net/fm10k: fix mbuf free in vector Rx X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=84fff3425b896a465a29b92a81aab563c07847cd;p=dpdk.git net/fm10k: fix mbuf free in vector Rx There's a corner case that all the Rx queue mbufs are allocated but none of them is used, this patch fixes mbuf free for this case. Fixes: b6719f8a04bb ("fm10k: release mbuf for vector Rx") Cc: stable@dpdk.org Signed-off-by: Xiao Wang Signed-off-by: Anna Lukin Reviewed-by: Xiaolong Ye --- diff --git a/drivers/net/fm10k/fm10k_rxtx_vec.c b/drivers/net/fm10k/fm10k_rxtx_vec.c index 45542bef30..d76dfd16fd 100644 --- a/drivers/net/fm10k/fm10k_rxtx_vec.c +++ b/drivers/net/fm10k/fm10k_rxtx_vec.c @@ -359,8 +359,15 @@ fm10k_rx_queue_release_mbufs_vec(struct fm10k_rx_queue *rxq) return; /* free all mbufs that are valid in the ring */ - for (i = rxq->next_dd; i != rxq->rxrearm_start; i = (i + 1) & mask) - rte_pktmbuf_free_seg(rxq->sw_ring[i]); + if (rxq->rxrearm_nb == 0) { + for (i = 0; i < rxq->nb_desc; i++) + if (rxq->sw_ring[i] != NULL) + rte_pktmbuf_free_seg(rxq->sw_ring[i]); + } else { + for (i = rxq->next_dd; i != rxq->rxrearm_start; + i = (i + 1) & mask) + rte_pktmbuf_free_seg(rxq->sw_ring[i]); + } rxq->rxrearm_nb = rxq->nb_desc; /* set all entries to NULL */