|
|
9ae3a8 |
From 06ca4cab12a4216d40c297d8a79c83a4df4dd80e Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Ladi Prosek <lprosek@redhat.com>
|
|
|
9ae3a8 |
Date: Wed, 5 Oct 2016 17:22:24 +0200
|
|
|
9ae3a8 |
Subject: [PATCH 2/8] virtio: introduce virtqueue_discard()
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Ladi Prosek <lprosek@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1475666548-9186-3-git-send-email-lprosek@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 72481
|
|
|
9ae3a8 |
O-Subject: [RHEL-7.4 qemu-kvm v2 PATCH 2/6] virtio: introduce virtqueue_discard()
|
|
|
9ae3a8 |
Bugzilla: 1377968
|
|
|
9ae3a8 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
From: Jason Wang <jasowang@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
This patch introduces virtqueue_discard() to discard a descriptor and
|
|
|
9ae3a8 |
unmap the sgs. This will be used by the patch that will discard
|
|
|
9ae3a8 |
descriptor when packet is truncated.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Cc: Michael S. Tsirkin <mst@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Jason Wang <jasowang@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit 29b9f5efd78ae0f9cc02dd169b6e80d2c404bade)
|
|
|
9ae3a8 |
Signed-off-by: Ladi Prosek <lprosek@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
hw/virtio/virtio.c | 7 +++++++
|
|
|
9ae3a8 |
include/hw/virtio/virtio.h | 2 ++
|
|
|
9ae3a8 |
2 files changed, 9 insertions(+)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
|
|
|
9ae3a8 |
index 5ee899a..91c9642 100644
|
|
|
9ae3a8 |
--- a/hw/virtio/virtio.c
|
|
|
9ae3a8 |
+++ b/hw/virtio/virtio.c
|
|
|
9ae3a8 |
@@ -251,6 +251,13 @@ static void virtqueue_unmap_sg(VirtQueue *vq, const VirtQueueElement *elem,
|
|
|
9ae3a8 |
0, elem->out_sg[i].iov_len);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+void virtqueue_discard(VirtQueue *vq, const VirtQueueElement *elem,
|
|
|
9ae3a8 |
+ unsigned int len)
|
|
|
9ae3a8 |
+{
|
|
|
9ae3a8 |
+ vq->last_avail_idx--;
|
|
|
9ae3a8 |
+ virtqueue_unmap_sg(vq, elem, len);
|
|
|
9ae3a8 |
+}
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
void virtqueue_fill(VirtQueue *vq, const VirtQueueElement *elem,
|
|
|
9ae3a8 |
unsigned int len, unsigned int idx)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
|
|
|
9ae3a8 |
index 9e22865..de32425 100644
|
|
|
9ae3a8 |
--- a/include/hw/virtio/virtio.h
|
|
|
9ae3a8 |
+++ b/include/hw/virtio/virtio.h
|
|
|
9ae3a8 |
@@ -165,6 +165,8 @@ void virtio_del_queue(VirtIODevice *vdev, int n);
|
|
|
9ae3a8 |
void virtqueue_push(VirtQueue *vq, const VirtQueueElement *elem,
|
|
|
9ae3a8 |
unsigned int len);
|
|
|
9ae3a8 |
void virtqueue_flush(VirtQueue *vq, unsigned int count);
|
|
|
9ae3a8 |
+void virtqueue_discard(VirtQueue *vq, const VirtQueueElement *elem,
|
|
|
9ae3a8 |
+ unsigned int len);
|
|
|
9ae3a8 |
void virtqueue_fill(VirtQueue *vq, const VirtQueueElement *elem,
|
|
|
9ae3a8 |
unsigned int len, unsigned int idx);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.8.3.1
|
|
|
9ae3a8 |
|