DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tom Kiely <tkiely@brocade.com>
To: <dev@dpdk.org>
Subject: [dpdk-dev] [PATCH] virtio: fix rx ring descriptor starvation
Date: Fri, 13 Nov 2015 09:30:13 +0000	[thread overview]
Message-ID: <1447407013-6986-1-git-send-email-tkiely@brocade.com> (raw)

If all rx descriptors are processed while transient
mbuf exhaustion is present, the rx ring ends up with
no available descriptors. Thus no packets are received
on that ring. Since descriptor refill is performed post
rx descriptor processing, in this case no refill is
ever subsequently performed resulting in permanent rx
traffic drop.

Signed-off-by: Tom Kiely <tkiely@brocade.com>
---
 drivers/net/virtio/virtio_rxtx.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index 5770fa2..a95e234 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -586,7 +586,8 @@ 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)
+	/* Refill free descriptors even if no pkts recvd */
+	if (num == 0 && virtqueue_full(rxvq))
 		return 0;
 
 	num = virtqueue_dequeue_burst_rx(rxvq, rcv_pkts, len, num);
@@ -683,7 +684,8 @@ virtio_recv_mergeable_pkts(void *rx_queue,
 
 	virtio_rmb();
 
-	if (nb_used == 0)
+	/* Refill free descriptors even if no pkts recvd */
+	if (nb_used == 0 && virtqueue_full(rxvq))
 		return 0;
 
 	PMD_RX_LOG(DEBUG, "used:%d\n", nb_used);
-- 
1.7.10.4

             reply	other threads:[~2015-11-13  9:30 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-13  9:30 Tom Kiely [this message]
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
2016-02-26 18:58 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=1447407013-6986-1-git-send-email-tkiely@brocade.com \
    --to=tkiely@brocade.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).