From: Kyle Larose <klarose@sandvine.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] virtio: fix rx ring descriptor starvation
Date: Fri, 26 Feb 2016 13:58:07 -0500 [thread overview]
Message-ID: <1456513087-28644-1-git-send-email-klarose@sandvine.com> (raw)
Virtio has an mbuf descriptor ring containing mbufs to be used for receiving
traffic. When the host queues traffic to be sent to the guest, it consumes
these descriptors. If none exist, it discards the packet.
The virtio pmd allocates mbufs to the descriptor ring every time it
succesfully receives a packet. However, it never does it if it does not
receive a valid packet. If the descriptor ring is exhausted, and the mbuf
mempool does not have any mbufs free (which can happen for various reasons,
such as queueing along the processing pipeline), then the receive call will
not allocate any mbufs to the descriptor ring, and when it finishes, the
descriptor ring will be empty. The ring being empty means that we will never
receive a packet again, which means we will never allocate mbufs to the ring:
we are stuck.
Ultimately, the problem arises because there is a dependency between receiving
packets and making the descriptor ring not be empty, and a dependency between
the descriptor ring not being empty, and receicing packets.
To fix the problem, this pakes makes virtio always try to allocate mbufs to the descriptor
ring, if necessary, when polling for packets. Do this by removing the early
exit if no packets were received. Since the packet loop later will do
nothing if there are no packets, this is fine.
---
drivers/net/virtio/virtio_rxtx.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index 41a1366..9d2f7d6 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -571,9 +571,6 @@ virtio_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
if (likely(num > DESC_PER_CACHELINE))
num = num - ((rxvq->vq_used_cons_idx + num) % DESC_PER_CACHELINE);
- if (num == 0)
- return 0;
-
num = virtqueue_dequeue_burst_rx(rxvq, rcv_pkts, len, num);
PMD_RX_LOG(DEBUG, "used:%d dequeue:%d", nb_used, num);
@@ -671,9 +668,6 @@ virtio_recv_mergeable_pkts(void *rx_queue,
virtio_rmb();
- if (nb_used == 0)
- return 0;
-
PMD_RX_LOG(DEBUG, "used:%d\n", nb_used);
hw = rxvq->hw;
--
1.8.3.1
next reply other threads:[~2016-02-26 18:58 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-26 18:58 Kyle Larose [this message]
-- strict thread matches above, loose matches on Subject: below --
2015-11-13 9:30 Tom Kiely
2015-11-24 21:20 ` Thomas Monjalon
2015-11-25 1:50 ` Yuanhan Liu
2015-11-25 2:51 ` Xie, Huawei
2015-11-25 17:32 ` Xie, Huawei
[not found] ` <C37D651A908B024F974696C65296B57B4C545F75@SHSMSX101.ccr.corp.intel.com>
2015-12-17 9:22 ` Tom Kiely
2015-12-17 11:18 ` Tom Kiely
2016-01-05 7:13 ` Xie, Huawei
2016-02-10 15:07 ` Bruce Richardson
2016-02-18 14:03 ` Kyle Larose
2016-02-22 16:23 ` Tom Kiely
2016-02-23 8:26 ` Xie, Huawei
2016-03-04 6:16 ` Xie, Huawei
2016-03-04 8:11 ` Tom Kiely
2016-03-04 13:25 ` Kyle Larose
2016-03-09 21:37 ` Bruce Richardson
2016-03-10 14:46 ` Kyle Larose
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=1456513087-28644-1-git-send-email-klarose@sandvine.com \
--to=klarose@sandvine.com \
--cc=dev@dpdk.org \
/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).