Clearing mbuf, first_seg when chaining mbufs fail.
Increment the error count for the same.

Fixes: 965b3127d425 ("net/axgbe: support scattered Rx")
Cc: sta...@dpdk.org

Signed-off-by: Bhagyada Modali <bhagyada.mod...@amd.com>
---
 drivers/net/axgbe/axgbe_rxtx.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/axgbe/axgbe_rxtx.c b/drivers/net/axgbe/axgbe_rxtx.c
index e1488483bc..c1f51ed6d6 100644
--- a/drivers/net/axgbe/axgbe_rxtx.c
+++ b/drivers/net/axgbe/axgbe_rxtx.c
@@ -418,8 +418,10 @@ uint16_t eth_axgbe_recv_scattered_pkts(void *rx_queue,
 
                if (first_seg != NULL) {
                        if (rte_pktmbuf_chain(first_seg, mbuf) != 0) {
-                               rte_mempool_put(rxq->mb_pool,
-                                               first_seg);
+                               rte_pktmbuf_free(first_seg);
+                               first_seg = NULL;
+                               rte_pktmbuf_free(mbuf);
+                               rxq->errors++;
                                eop = 0;
                                break;
                        }
-- 
2.25.1

Reply via email to