[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 21/22] virtio: introduce virtqueue_discard()
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 21/22] virtio: introduce virtqueue_discard() |
Date: |
Thu, 24 Sep 2015 16:21:05 +0300 |
From: Jason Wang <address@hidden>
This patch introduces virtqueue_discard() to discard a descriptor and
unmap the sgs. This will be used by the patch that will discard
descriptor when packet is truncated.
Cc: Michael S. Tsirkin <address@hidden>
Signed-off-by: Jason Wang <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
include/hw/virtio/virtio.h | 2 ++
hw/virtio/virtio.c | 7 +++++++
2 files changed, 9 insertions(+)
diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index 6201ee8..9d09115 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -146,6 +146,8 @@ void virtio_del_queue(VirtIODevice *vdev, int n);
void virtqueue_push(VirtQueue *vq, const VirtQueueElement *elem,
unsigned int len);
void virtqueue_flush(VirtQueue *vq, unsigned int count);
+void virtqueue_discard(VirtQueue *vq, const VirtQueueElement *elem,
+ unsigned int len);
void virtqueue_fill(VirtQueue *vq, const VirtQueueElement *elem,
unsigned int len, unsigned int idx);
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index d6a2bca..c9bf10c 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -266,6 +266,13 @@ static void virtqueue_unmap_sg(VirtQueue *vq, const
VirtQueueElement *elem,
0, elem->out_sg[i].iov_len);
}
+void virtqueue_discard(VirtQueue *vq, const VirtQueueElement *elem,
+ unsigned int len)
+{
+ vq->last_avail_idx--;
+ virtqueue_unmap_sg(vq, elem, len);
+}
+
void virtqueue_fill(VirtQueue *vq, const VirtQueueElement *elem,
unsigned int len, unsigned int idx)
{
--
MST
- [Qemu-devel] [PULL 04/22] q35: Move options common to all classes to pc_i440fx_machine_options(), (continued)
- [Qemu-devel] [PULL 04/22] q35: Move options common to all classes to pc_i440fx_machine_options(), Michael S. Tsirkin, 2015/09/24
- [Qemu-devel] [PULL 05/22] pc: Introduce pc-*-2.5 machine classes, Michael S. Tsirkin, 2015/09/24
- [Qemu-devel] [PULL 06/22] virtio: ring sizes vs. reset, Michael S. Tsirkin, 2015/09/24
- [Qemu-devel] [PULL 07/22] virtio-ccw: support ring size changes, Michael S. Tsirkin, 2015/09/24
- [Qemu-devel] [PULL 08/22] virtio-ccw: feature bits > 31 handling, Michael S. Tsirkin, 2015/09/24
- [Qemu-devel] [PULL 09/22] virtio-ccw: enable virtio-1, Michael S. Tsirkin, 2015/09/24
- [Qemu-devel] [PULL 10/22] vhost-user: use VHOST_USER_XXX macro for switch statement, Michael S. Tsirkin, 2015/09/24
- [Qemu-devel] [PULL 11/22] vhost-user: add protocol feature negotiation, Michael S. Tsirkin, 2015/09/24
- [Qemu-devel] [PULL 12/22] vhost: rename VHOST_RESET_OWNER to VHOST_RESET_DEVICE, Michael S. Tsirkin, 2015/09/24
- [Qemu-devel] [PULL 19/22] MAINTAINERS: add more devices to the PCI section, Michael S. Tsirkin, 2015/09/24
- [Qemu-devel] [PULL 21/22] virtio: introduce virtqueue_discard(),
Michael S. Tsirkin <=
- [Qemu-devel] [PULL 22/22] virtio-net: correctly drop truncated packets, Michael S. Tsirkin, 2015/09/24
- [Qemu-devel] [PULL 20/22] virtio: introduce virtqueue_unmap_sg(), Michael S. Tsirkin, 2015/09/24
- [Qemu-devel] [PULL 14/22] vhost: introduce vhost_backend_get_vq_index method, Michael S. Tsirkin, 2015/09/24
- [Qemu-devel] [PULL 18/22] MAINTAINERS: add more devices to the PC section, Michael S. Tsirkin, 2015/09/24
- [Qemu-devel] [PULL 15/22] vhost-user: add multiple queue support, Michael S. Tsirkin, 2015/09/24
- [Qemu-devel] [PULL 17/22] intel_iommu: Add support for translation for devices behind bridges, Michael S. Tsirkin, 2015/09/24