Save the segments of the packet, when the next descriptor data is not ready.
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 | 11 +++++++++++ drivers/net/axgbe/axgbe_rxtx.h | 6 ++++++ 2 files changed, 17 insertions(+) diff --git a/drivers/net/axgbe/axgbe_rxtx.c b/drivers/net/axgbe/axgbe_rxtx.c index c1f51ed6d6..65bda2a0d3 100644 --- a/drivers/net/axgbe/axgbe_rxtx.c +++ b/drivers/net/axgbe/axgbe_rxtx.c @@ -416,11 +416,17 @@ uint16_t eth_axgbe_recv_scattered_pkts(void *rx_queue, mbuf->data_len = data_len; mbuf->pkt_len = data_len; + if (rxq->saved_mbuf) { + first_seg = rxq->saved_mbuf; + rxq->saved_mbuf = NULL; + } + if (first_seg != NULL) { if (rte_pktmbuf_chain(first_seg, mbuf) != 0) { rte_pktmbuf_free(first_seg); first_seg = NULL; rte_pktmbuf_free(mbuf); + rxq->saved_mbuf = NULL; rxq->errors++; eop = 0; break; @@ -502,6 +508,11 @@ uint16_t eth_axgbe_recv_scattered_pkts(void *rx_queue, first_seg = NULL; } + /* Check if we need to save state before leaving */ + if (first_seg != NULL && eop == 0) + rxq->saved_mbuf = first_seg; + + /* Save receive context.*/ rxq->pkts += nb_rx; diff --git a/drivers/net/axgbe/axgbe_rxtx.h b/drivers/net/axgbe/axgbe_rxtx.h index 2a330339cd..2da3095547 100644 --- a/drivers/net/axgbe/axgbe_rxtx.h +++ b/drivers/net/axgbe/axgbe_rxtx.h @@ -65,6 +65,12 @@ struct axgbe_rx_queue { uint16_t crc_len; /* address of s/w rx buffers */ struct rte_mbuf **sw_ring; + + /* For segemented packets - save the current state + * of packet, if next descriptor is not ready yet + */ + struct rte_mbuf *saved_mbuf; + /* Port private data */ struct axgbe_port *pdata; /* Number of Rx descriptors in queue */ -- 2.25.1