numam-dpdk/drivers/net/virtio
Kyle Larose 3eabd79c50 virtio: fix Rx ring descriptor starvation
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
successfully 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 receiving
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.

I reproduced the problem by pushing packets through a pipelined systems
(such as the client_server sample application) after artificially
decreasing the size of the mbuf pool and introducing a delay in a secondary
stage.

Without the fix, the process stops receiving packets fairly quicky. With
the fix, it continues to receive packets.

Fixes: c1f86306a0 ("virtio: add new driver")

Signed-off-by: Kyle Larose <klarose@sandvine.com>
Acked-by: Huawei Xie <huawei.xie@intel.com>
2016-03-25 19:01:37 +01:00
..
Makefile virtio: restrict vector Rx/Tx to x86 SSSE3 2016-03-03 14:00:28 +01:00
rte_pmd_virtio_version.map virtio: move to drivers/net/ 2015-05-22 16:06:23 +02:00
virtio_ethdev.c virtio: remove redundant function names in log 2016-03-16 19:05:46 +01:00
virtio_ethdev.h virtio: support specification 1.0 2016-02-03 16:07:50 +01:00
virtio_logs.h virtio: move to drivers/net/ 2015-05-22 16:06:23 +02:00
virtio_pci.c virtio: fix query of legacy features 2016-03-14 23:16:15 +01:00
virtio_pci.h virtio: use PCI ioport API 2016-02-16 22:55:44 +01:00
virtio_ring.h virtio: fix Coverity unsigned warnings 2015-10-21 16:14:02 +02:00
virtio_rxtx_simple.c mbuf: get DMA address 2016-03-04 16:01:15 +01:00
virtio_rxtx.c virtio: fix Rx ring descriptor starvation 2016-03-25 19:01:37 +01:00
virtio_rxtx.h virtio: restrict vector Rx/Tx to x86 SSSE3 2016-03-03 14:00:28 +01:00
virtqueue.c virtio: check virtqueue parameter when detaching 2015-07-19 22:24:42 +02:00
virtqueue.h virtio: use indirect ring elements 2016-03-16 19:05:25 +01:00