patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 0/3] net/virtio: Fix packet segmentation bug
@ 2019-06-04 15:31 Maxime Coquelin
  2019-06-04 15:31 ` [dpdk-stable] [PATCH 1/3] net/virtio: fix segmented packet issue in in-order Rx path Maxime Coquelin
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Maxime Coquelin @ 2019-06-04 15:31 UTC (permalink / raw)
  To: dev, ybrustin, tiwei.bie, jfreimann; +Cc: stable, Maxime Coquelin

This series fixes a bug reported by Yaroslav, where segmented
packets miss some segments.

Last patch is not a fix, but it removes some useless checks
in Rx paths.

Yaroslav, can you try the series and confirm it fixes the issue
you faced?

Maxime Coquelin (3):
  net/virtio: fix segmented packet issue in in-order Rx path
  net/virtio: fix segmented packet issue in mergeable Rx path
  net/virtio: remove useless pointers checks

 drivers/net/virtio/virtio_rxtx.c | 21 ++++++---------------
 1 file changed, 6 insertions(+), 15 deletions(-)

-- 
2.21.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-stable] [PATCH 1/3] net/virtio: fix segmented packet issue in in-order Rx path
  2019-06-04 15:31 [dpdk-stable] [PATCH 0/3] net/virtio: Fix packet segmentation bug Maxime Coquelin
@ 2019-06-04 15:31 ` Maxime Coquelin
  2019-06-04 15:31 ` [dpdk-stable] [PATCH 2/3] net/virtio: fix segmented packet issue in mergeable " Maxime Coquelin
  2019-06-04 15:31 ` [dpdk-stable] [PATCH 3/3] net/virtio: remove useless pointers checks Maxime Coquelin
  2 siblings, 0 replies; 4+ messages in thread
From: Maxime Coquelin @ 2019-06-04 15:31 UTC (permalink / raw)
  To: dev, ybrustin, tiwei.bie, jfreimann; +Cc: stable, Maxime Coquelin

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@dpdk.org

Reported-by: Yaroslav Brustinov <ybrustin@cisco.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-stable] [PATCH 2/3] net/virtio: fix segmented packet issue in mergeable Rx path
  2019-06-04 15:31 [dpdk-stable] [PATCH 0/3] net/virtio: Fix packet segmentation bug Maxime Coquelin
  2019-06-04 15:31 ` [dpdk-stable] [PATCH 1/3] net/virtio: fix segmented packet issue in in-order Rx path Maxime Coquelin
@ 2019-06-04 15:31 ` Maxime Coquelin
  2019-06-04 15:31 ` [dpdk-stable] [PATCH 3/3] net/virtio: remove useless pointers checks Maxime Coquelin
  2 siblings, 0 replies; 4+ messages in thread
From: Maxime Coquelin @ 2019-06-04 15:31 UTC (permalink / raw)
  To: dev, ybrustin, tiwei.bie, jfreimann; +Cc: stable, Maxime Coquelin

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: bcac5aa207f8 ("net/virtio: improve batching in mergeable path")
Cc: stable@dpdk.org

Reported-by: Yaroslav Brustinov <ybrustin@cisco.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Signed-off-by: Maxime Coquelin <maxime.coquelin@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 6e76596e56..901490217c 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -1615,7 +1615,7 @@ virtio_recv_mergeable_pkts(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 = 0;
 	uint32_t len[VIRTIO_MBUF_BURST_SZ];
 	struct rte_mbuf *rcv_pkts[VIRTIO_MBUF_BURST_SZ];
@@ -1722,7 +1722,6 @@ virtio_recv_mergeable_pkts(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_burst_rx(vq, rcv_pkts, len,
-- 
2.21.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-stable] [PATCH 3/3] net/virtio: remove useless pointers checks
  2019-06-04 15:31 [dpdk-stable] [PATCH 0/3] net/virtio: Fix packet segmentation bug Maxime Coquelin
  2019-06-04 15:31 ` [dpdk-stable] [PATCH 1/3] net/virtio: fix segmented packet issue in in-order Rx path Maxime Coquelin
  2019-06-04 15:31 ` [dpdk-stable] [PATCH 2/3] net/virtio: fix segmented packet issue in mergeable " Maxime Coquelin
@ 2019-06-04 15:31 ` Maxime Coquelin
  2 siblings, 0 replies; 4+ messages in thread
From: Maxime Coquelin @ 2019-06-04 15:31 UTC (permalink / raw)
  To: dev, ybrustin, tiwei.bie, jfreimann; +Cc: stable, Maxime Coquelin

This patch removes uses checks on 'prev' pointer, as it
is always set before with a valid value.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 drivers/net/virtio/virtio_rxtx.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index 901490217c..7a6985e4e3 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -1518,9 +1518,7 @@ virtio_recv_pkts_inorder(void *rx_queue,
 			rx_pkts[nb_rx]->pkt_len += (uint32_t)(len[i]);
 			rx_pkts[nb_rx]->data_len += (uint16_t)(len[i]);
 
-			if (prev)
-				prev->next = rxm;
-
+			prev->next = rxm;
 			prev = rxm;
 			seg_res -= 1;
 		}
@@ -1704,9 +1702,7 @@ virtio_recv_mergeable_pkts(void *rx_queue,
 			rx_pkts[nb_rx]->pkt_len += (uint32_t)(len[i]);
 			rx_pkts[nb_rx]->data_len += (uint16_t)(len[i]);
 
-			if (prev)
-				prev->next = rxm;
-
+			prev->next = rxm;
 			prev = rxm;
 			seg_res -= 1;
 		}
@@ -1881,9 +1877,7 @@ virtio_recv_mergeable_pkts_packed(void *rx_queue,
 			rx_pkts[nb_rx]->pkt_len += (uint32_t)(len[i]);
 			rx_pkts[nb_rx]->data_len += (uint16_t)(len[i]);
 
-			if (prev)
-				prev->next = rxm;
-
+			prev->next = rxm;
 			prev = rxm;
 			seg_res -= 1;
 		}
@@ -1927,8 +1921,7 @@ virtio_recv_mergeable_pkts_packed(void *rx_queue,
 		} else {
 			PMD_RX_LOG(ERR,
 					"No enough segments for packet.");
-			if (prev)
-				virtio_discard_rxbuf(vq, prev);
+			virtio_discard_rxbuf(vq, prev);
 			rxvq->stats.errors++;
 			break;
 		}
-- 
2.21.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-06-04 15:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-04 15:31 [dpdk-stable] [PATCH 0/3] net/virtio: Fix packet segmentation bug Maxime Coquelin
2019-06-04 15:31 ` [dpdk-stable] [PATCH 1/3] net/virtio: fix segmented packet issue in in-order Rx path Maxime Coquelin
2019-06-04 15:31 ` [dpdk-stable] [PATCH 2/3] net/virtio: fix segmented packet issue in mergeable " Maxime Coquelin
2019-06-04 15:31 ` [dpdk-stable] [PATCH 3/3] net/virtio: remove useless pointers checks Maxime Coquelin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).