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 <xiao.w.wang@intel.com>
Signed-off-by: Anna Lukin <annal@silicom.co.il>
Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
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 */