Reset the eop in the failure scenario and also after the last segment.
Removed the packet length updation explicitly as it is done in Chaining.

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 | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/net/axgbe/axgbe_rxtx.c b/drivers/net/axgbe/axgbe_rxtx.c
index 8b43e8160b..e1488483bc 100644
--- a/drivers/net/axgbe/axgbe_rxtx.c
+++ b/drivers/net/axgbe/axgbe_rxtx.c
@@ -346,10 +346,11 @@ uint16_t eth_axgbe_recv_scattered_pkts(void *rx_queue,
        uint32_t error_status = 0;
        uint16_t idx, pidx, data_len = 0, pkt_len = 0;
        uint64_t offloads;
+       bool eop = 0;
 
        idx = AXGBE_GET_DESC_IDX(rxq, rxq->cur);
+
        while (nb_rx < nb_pkts) {
-               bool eop = 0;
 next_desc:
                idx = AXGBE_GET_DESC_IDX(rxq, rxq->cur);
 
@@ -416,9 +417,12 @@ uint16_t eth_axgbe_recv_scattered_pkts(void *rx_queue,
                mbuf->pkt_len = data_len;
 
                if (first_seg != NULL) {
-                       if (rte_pktmbuf_chain(first_seg, mbuf) != 0)
+                       if (rte_pktmbuf_chain(first_seg, mbuf) != 0) {
                                rte_mempool_put(rxq->mb_pool,
                                                first_seg);
+                               eop = 0;
+                               break;
+                       }
                } else {
                        first_seg = mbuf;
                }
@@ -462,8 +466,8 @@ uint16_t eth_axgbe_recv_scattered_pkts(void *rx_queue,
                        rte_pktmbuf_free(mbuf);
                        goto next_desc;
                }
+               eop = 0;
 
-               first_seg->pkt_len = pkt_len;
                rxq->bytes += pkt_len;
                mbuf->next = NULL;
 
-- 
2.25.1

Reply via email to