diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2010-11-04 14:24:24 +0200 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2010-11-24 15:21:11 +1030 |
commit | 7ae4b866f86f9ab7b99484b56dd303a860ad1cc9 (patch) | |
tree | 247cd281bdf2e892180ff3407377d0a212c30016 /drivers | |
parent | dfd62d1d84d83f9421792c78bcf72de9bc2bb603 (diff) | |
download | linux-3.10-7ae4b866f86f9ab7b99484b56dd303a860ad1cc9.tar.gz linux-3.10-7ae4b866f86f9ab7b99484b56dd303a860ad1cc9.tar.bz2 linux-3.10-7ae4b866f86f9ab7b99484b56dd303a860ad1cc9.zip |
virtio: return correct capacity to users
We can't rely on indirect buffers for capacity
calculations because they need a memory allocation
which might fail. In particular, virtio_net can get
into this situation under stress, and it drops packets
and performs badly.
So return the number of buffers we can guarantee users.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Reported-By: Krishna Kumar2 <krkumar2@in.ibm.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/virtio/virtio_ring.c | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 1475ed6b575..cc2f73e0347 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -230,9 +230,6 @@ add_head: pr_debug("Added buffer head %i to %p\n", head, vq); END_USE(vq); - /* If we're indirect, we can fit many (assuming not OOM). */ - if (vq->indirect) - return vq->num_free ? vq->vring.num : 0; return vq->num_free; } EXPORT_SYMBOL_GPL(virtqueue_add_buf_gfp); |