[dpdk-dev] [PATCH 1/3] net/virtio: fix segmented packet issue in in-order Rx path

Maxime Coquelin maxime.coquelin at redhat.com
Tue Jun 4 17:31:20 CEST 2019


After having dequeued a burst of descriptors, there may be a
need to dequeue a few more if the last packet was segmented
and not complete.

When it happens, the extra segments were not properly attached
to the mbuf chain, and so were lost.

This patch fixes the mbuf chaining.

Fixes: e5f456a98d3c ("net/virtio: support in-order Rx and Tx")
Cc: stable at dpdk.org

Reported-by: Yaroslav Brustinov <ybrustin at cisco.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin at redhat.com>
---
 drivers/net/virtio/virtio_rxtx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index 1de28540cd..6e76596e56 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -1424,7 +1424,7 @@ virtio_recv_pkts_inorder(void *rx_queue,
 	struct virtqueue *vq = rxvq->vq;
 	struct virtio_hw *hw = vq->hw;
 	struct rte_mbuf *rxm;
-	struct rte_mbuf *prev;
+	struct rte_mbuf *prev = NULL;
 	uint16_t nb_used, num, nb_rx;
 	uint32_t len[VIRTIO_MBUF_BURST_SZ];
 	struct rte_mbuf *rcv_pkts[VIRTIO_MBUF_BURST_SZ];
@@ -1536,7 +1536,6 @@ virtio_recv_pkts_inorder(void *rx_queue,
 		uint16_t rcv_cnt = RTE_MIN((uint16_t)seg_res,
 					VIRTIO_MBUF_BURST_SZ);
 
-		prev = rcv_pkts[nb_rx];
 		if (likely(VIRTQUEUE_NUSED(vq) >= rcv_cnt)) {
 			virtio_rmb(hw->weak_barriers);
 			num = virtqueue_dequeue_rx_inorder(vq, rcv_pkts, len,
-- 
2.21.0



More information about the dev mailing list