[v2,3/3] net/axgbe: save segment data in scattered Rx

Message ID 20220908033109.126547-3-bhagyada.modali@amd.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series [v2,1/3] net/axgbe: reset the end of packet in scattered rx |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-x86_64-unit-testing fail Testing issues
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/Intel-compilation warning apply issues

Commit Message

Bhagyada Modali Sept. 8, 2022, 3:31 a.m. UTC
  Saving the current segments of the packet,
when the next segment data is not ready.

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

Signed-off-by: Bhagyada Modali <bhagyada.modali@amd.com>
---
 drivers/net/axgbe/axgbe_rxtx.c | 11 +++++++++++
 drivers/net/axgbe/axgbe_rxtx.h |  6 ++++++
 2 files changed, 17 insertions(+)
  

Patch

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 */