[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v6 9/9] virtio: Move vdev->broken check to dispatch drop_all
From: |
Eugenio Pérez |
Subject: |
[PATCH v6 9/9] virtio: Move vdev->broken check to dispatch drop_all |
Date: |
Thu, 24 Oct 2019 19:14:06 +0200 |
Previous commits did the same with others virtqueue_ functions, but this
check was repeated in the split and the packed version.
Signed-off-by: Eugenio Pérez <address@hidden>
---
hw/virtio/virtio.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 9195b08da8..828c27de1f 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -1631,10 +1631,6 @@ static unsigned int virtqueue_packed_drop_all(VirtQueue
*vq)
VirtIODevice *vdev = vq->vdev;
VRingPackedDesc desc;
- if (unlikely(vdev->broken)) {
- return 0;
- }
-
caches = vring_get_region_caches(vq);
desc_cache = &caches->desc;
@@ -1680,10 +1676,6 @@ static unsigned int virtqueue_split_drop_all(VirtQueue
*vq)
VirtIODevice *vdev = vq->vdev;
bool fEventIdx = virtio_vdev_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX);
- if (unlikely(vdev->broken)) {
- return 0;
- }
-
while (!virtio_queue_empty(vq) && vq->inuse < vq->vring.num) {
/* works similar to virtqueue_pop but does not map buffers
* and does not allocate any memory */
@@ -1715,6 +1707,10 @@ unsigned int virtqueue_drop_all(VirtQueue *vq)
{
struct VirtIODevice *vdev = vq->vdev;
+ if (unlikely(vdev->broken)) {
+ return 0;
+ }
+
if (virtio_vdev_has_feature(vdev, VIRTIO_F_RING_PACKED)) {
return virtqueue_packed_drop_all(vq);
} else {
--
2.16.5
- [PATCH v6 0/9] Packed virtqueue for virtio, Eugenio Pérez, 2019/10/24
- [PATCH v6 1/9] virtio: basic structure for packed ring, Eugenio Pérez, 2019/10/24
- [PATCH v6 2/9] virtio: device/driver area size calculation refactor for split ring, Eugenio Pérez, 2019/10/24
- [PATCH v6 3/9] virtio: Free rng and blk virqueues, Eugenio Pérez, 2019/10/24
- [PATCH v6 5/9] virtio: event suppression support for packed ring, Eugenio Pérez, 2019/10/24
- [PATCH v6 6/9] vhost_net: enable packed ring support, Eugenio Pérez, 2019/10/24
- [PATCH v6 4/9] virtio: basic packed virtqueue support, Eugenio Pérez, 2019/10/24
- [PATCH v6 7/9] virtio: add property to enable packed virtqueue, Eugenio Pérez, 2019/10/24
- [PATCH v6 8/9] virtio: add some rcu comments, Eugenio Pérez, 2019/10/24
- [PATCH v6 9/9] virtio: Move vdev->broken check to dispatch drop_all,
Eugenio Pérez <=
- Re: [PATCH v6 0/9] Packed virtqueue for virtio, Jason Wang, 2019/10/24