From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: dev@dpdk.org, ybrustin@cisco.com, tiwei.bie@intel.com,
jfreimann@redhat.com, david.marchand@redhat.com
Cc: stable@dpdk.org, Maxime Coquelin <maxime.coquelin@redhat.com>
Subject: [dpdk-dev] [PATCH v3 2/4] net/virtio: fix segmented packet issue in mergeable Rx path
Date: Wed, 5 Jun 2019 12:00:37 +0200 [thread overview]
Message-ID: <20190605100039.18029-3-maxime.coquelin@redhat.com> (raw)
In-Reply-To: <20190605100039.18029-1-maxime.coquelin@redhat.com>
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.
Also, head segment data_len field is wrongly summed with
the length of all the segments of the chain.
This patch fixes both the mbuf chaining and head segment's
data_len field
Fixes: bcac5aa207f8 ("net/virtio: improve batching in mergeable path")
Cc: stable@dpdk.org
Reported-by: Yaroslav Brustinov <ybrustin@cisco.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
drivers/net/virtio/virtio_rxtx.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index 450023eaac..acee4fcc07 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -1613,7 +1613,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];
@@ -1700,7 +1700,6 @@ virtio_recv_mergeable_pkts(void *rx_queue,
rxm->data_len = (uint16_t)(len[i]);
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;
@@ -1720,7 +1719,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,
@@ -1737,7 +1735,6 @@ virtio_recv_mergeable_pkts(void *rx_queue,
prev->next = rxm;
prev = rxm;
rx_pkts[nb_rx]->pkt_len += len[extra_idx];
- rx_pkts[nb_rx]->data_len += len[extra_idx];
extra_idx += 1;
};
seg_res -= rcv_cnt;
--
2.21.0
next prev parent reply other threads:[~2019-06-05 10:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-05 10:00 [dpdk-dev] [PATCH v3 0/4] et/virtio: Fix packet segmentation bug Maxime Coquelin
2019-06-05 10:00 ` [dpdk-dev] [PATCH v3 1/4] net/virtio: fix segmented packet issue in in-order Rx path Maxime Coquelin
2019-06-05 10:00 ` Maxime Coquelin [this message]
2019-06-05 10:00 ` [dpdk-dev] [PATCH v3 3/4] net/virtio: fix segment data len in mergeable packed " Maxime Coquelin
2019-06-05 11:16 ` Jens Freimann
2019-06-05 11:34 ` Maxime Coquelin
2019-06-05 10:00 ` [dpdk-dev] [PATCH v3 4/4] net/virtio: remove useless pointers checks Maxime Coquelin
2019-06-06 7:15 ` Ye Xiaolong
2019-06-06 7:31 ` Maxime Coquelin
2019-06-05 13:25 ` [dpdk-dev] [PATCH v3 0/4] et/virtio: Fix packet segmentation bug Tiwei Bie
2019-06-06 9:31 ` Maxime Coquelin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190605100039.18029-3-maxime.coquelin@redhat.com \
--to=maxime.coquelin@redhat.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=jfreimann@redhat.com \
--cc=stable@dpdk.org \
--cc=tiwei.bie@intel.com \
--cc=ybrustin@cisco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).