Do you have any comments or suggestions about improvements to this patch
set?
Regards,
Kangjie
在 2022/7/18 19:16, Kangjie Xu 写道:
The virtio queue reset function has already been defined in the virtio spec 1.2.
The relevant virtio spec information is here:
https://github.com/oasis-tcs
在 2022/7/26 12:07, Jason Wang 写道:
在 2022/7/18 19:17, Kangjie Xu 写道:
Implement the vhost_set_single_vring_enable, which is to enable or
disable a single vring.
The parameter wait_for_reply is added to help for some cases such as
vq reset.
Meanwhile, vhost_user_set_vring_enable() is
在 2022/7/26 12:16, Jason Wang 写道:
在 2022/7/18 19:17, Kangjie Xu 写道:
Introduce vhost_virtqueue_restart(), which can restart the
virtqueue when the vhost net started running before.
Introduce vhost_virtqueue_stop(), which can disable the vq
and unmap vrings and the desc of the vq. When
在 2022/7/26 12:13, Jason Wang 写道:
在 2022/7/18 19:17, Kangjie Xu 写道:
Introduce vhost_dev_virtqueue_restart(), which can restart the
virtqueue when the vhost has already started running.
Meanwhile, vhost_dev_virtqueue_release(), which can ummap the
vrings and the desc of a specific vq of a
在 2022/7/26 11:17, Jason Wang 写道:
在 2022/7/18 19:16, Kangjie Xu 写道:
From: Xuan Zhuo
Add queue_notify_data in struct virtio_pci_common_cfg, which comes from
here https://github.com/oasis-tcs/virtio-spec/issues/89
Since I want to add queue_reset after queue_notify_data, I submitted
this
在 2022/7/26 12:17, Jason Wang 写道:
在 2022/7/18 19:17, Kangjie Xu 写道:
Introduce the interface queue_enable() in VirtioDeviceClass and the
fucntion virtio_queue_enable() in virtio, it can be called when
VIRTIO_PCI_COMMON_Q_ENABLE is written.
I'd suggest to split this series into tw
在 2022/7/26 12:28, Jason Wang 写道:
在 2022/7/18 19:17, Kangjie Xu 写道:
Add support for negotation of vq reset feature bit.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
I'd suggest to add support for vhost-net kernel as well. It looks much
more easier than vhost-user (I guess a
在 2022/7/26 11:49, Jason Wang 写道:
在 2022/7/18 19:17, Kangjie Xu 写道:
The interface to set enable status for a single vring is lacked in
VhostOps, since the vhost_set_vring_enable_op will manipulate all
virtqueues in a device.
Resetting a single vq will rely on this interface. It requires a
在 2022/7/26 12:25, Jason Wang 写道:
在 2022/7/18 19:17, Kangjie Xu 写道:
Support queue enable in vhost-user scenario. It will be called when
a vq reset operation is performed and the vq will be restared.
It should be noted that we can restart the vq when the vhost has
already started. When
在 2022/7/26 11:43, Jason Wang 写道:
在 2022/7/18 19:17, Kangjie Xu 写道:
From: Xuan Zhuo
virtio-net implements queue reset. Queued packets in the corresponding
queue pair are flushed or purged.
Queue reset is currently only implemented for non-vhosts.
Signed-off-by: Xuan Zhuo
---
hw/net
在 2022/7/27 13:00, Jason Wang 写道:
On Tue, Jul 26, 2022 at 3:02 PM Kangjie Xu wrote:
在 2022/7/26 11:43, Jason Wang 写道:
在 2022/7/18 19:17, Kangjie Xu 写道:
From: Xuan Zhuo
virtio-net implements queue reset. Queued packets in the corresponding
queue pair are flushed or purged.
Queue reset
在 2022/7/27 12:53, Jason Wang 写道:
On Tue, Jul 26, 2022 at 2:24 PM Kangjie Xu wrote:
在 2022/7/26 12:28, Jason Wang 写道:
在 2022/7/18 19:17, Kangjie Xu 写道:
Add support for negotation of vq reset feature bit.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
I'd suggest to add su
在 2022/7/27 12:51, Jason Wang 写道:
On Tue, Jul 26, 2022 at 1:27 PM Kangjie Xu wrote:
在 2022/7/26 12:07, Jason Wang 写道:
在 2022/7/18 19:17, Kangjie Xu 写道:
Implement the vhost_set_single_vring_enable, which is to enable or
disable a single vring.
The parameter wait_for_reply is added to help
在 2022/7/27 14:59, Jason Wang 写道:
On Wed, Jul 27, 2022 at 2:25 PM Kangjie Xu wrote:
在 2022/7/27 13:00, Jason Wang 写道:
On Tue, Jul 26, 2022 at 3:02 PM Kangjie Xu wrote:
在 2022/7/26 11:43, Jason Wang 写道:
在 2022/7/18 19:17, Kangjie Xu 写道:
From: Xuan Zhuo
virtio-net implements queue
在 2022/7/27 12:55, Jason Wang 写道:
On Tue, Jul 26, 2022 at 2:39 PM Kangjie Xu wrote:
在 2022/7/26 11:49, Jason Wang 写道:
在 2022/7/18 19:17, Kangjie Xu 写道:
The interface to set enable status for a single vring is lacked in
VhostOps, since the vhost_set_vring_enable_op will manipulate all
在 2022/7/27 12:47, Jason Wang 写道:
On Tue, Jul 26, 2022 at 1:13 PM Kangjie Xu wrote:
在 2022/7/26 12:13, Jason Wang 写道:
在 2022/7/18 19:17, Kangjie Xu 写道:
Introduce vhost_dev_virtqueue_restart(), which can restart the
virtqueue when the vhost has already started running.
Meanwhile
在 2022/7/28 10:41, Jason Wang 写道:
On Wed, Jul 27, 2022 at 3:05 PM Kangjie Xu wrote:
在 2022/7/27 12:55, Jason Wang 写道:
On Tue, Jul 26, 2022 at 2:39 PM Kangjie Xu wrote:
在 2022/7/26 11:49, Jason Wang 写道:
在 2022/7/18 19:17, Kangjie Xu 写道:
The interface to set enable status for a single
PCI devices support vq enable.
Based on this function, the driver can re-enable the virtqueue after the
virtqueue is reset.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
hw/virtio/virtio-pci.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio
start the virtqueue when DRIVER_OK.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
hw/virtio/virtio.c | 14 ++
include/hw/virtio/virtio.h | 2 ++
2 files changed, 16 insertions(+)
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 0e9d41366f..141f18c633 100644
-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
docs/interop/vhost-user.rst | 10 ++
1 file changed, 10 insertions(+)
diff --git a/docs/interop/vhost-user.rst b/docs/interop/vhost-user.rst
index 3f18ab424e..ce7991b9d3 100644
--- a/docs/interop/vhost-user.rst
+++ b/docs/interop/vhost
From: Xuan Zhuo
Introduce a new interface function virtio_queue_reset() to implement
reset for vq.
Add a new callback to VirtioDeviceClass for queue reset operation for
each child device.
Signed-off-by: Xuan Zhuo
---
hw/virtio/virtio.c | 11 +++
include/hw/virtio/virtio.h | 2
rds/linux/commit/19a91e0d7167b2031e46078c6215c213b89cb2c3
Looking forward to your review and comments. Thanks.
Kangjie Xu (19):
virtio: introduce virtio_queue_enable()
virtio: core: vq reset feature negotation support
virtio-pci: support queue enable
vhost: extract the l
. Migration
thread also needs the lock. As a result, we do not need to migrate the
reset state of VirtIOPCIQueue.
Signed-off-by: Xuan Zhuo
Signed-off-by: Kangjie Xu
---
hw/virtio/virtio-pci.c | 19 +++
include/hw/virtio/virtio-pci.h | 1 +
2 files changed, 20 insertions(+)
diff
Add virtqueue reset feature for vhost-kernel.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
hw/net/vhost_net.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index 778081e54a..9ea160e4e9 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net
from here:
https://github.com/oasis-tcs/virtio-spec/issues/89
Signed-off-by: Xuan Zhuo
Signed-off-by: Kangjie Xu
---
include/standard-headers/linux/virtio_config.h | 5 +
include/standard-headers/linux/virtio_pci.h| 2 ++
2 files changed, 7 insertions(+)
diff --git a/include/standard
Introduce vhost_virtqueue_unmap() to ummap the vrings and desc
of a virtqueue.
The function will be used later.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
hw/virtio/vhost.c | 20 ++--
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/hw/virtio/vhost.c
A a new command line parameter "queue_reset" is added.
Meanwhile, the vq reset feature is disabled for pre-7.1 machines.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
hw/core/machine.c | 1 +
include/hw/virtio/virtio.h | 4 +++-
2 files changed, 4 insertions(+),
From: Xuan Zhuo
Separate the logic of vq reset. This logic will be called directly
later.
Signed-off-by: Xuan Zhuo
---
hw/virtio/virtio.c | 37 +
1 file changed, 21 insertions(+), 16 deletions(-)
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 5d
Introduce vhost_dev_virtqueue_stop(), which can ummap the
vrings and the desc of it.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
hw/virtio/vhost.c | 9 +
include/hw/virtio/vhost.h | 3 +++
2 files changed, 12 insertions(+)
diff --git a/hw/virtio/vhost.c b/hw/virtio
Introduce vhost_dev_virtqueue_restart(), which can restart the
virtqueue when the vhost has already started running.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
hw/virtio/vhost.c | 13 +
include/hw/virtio/vhost.h | 2 ++
2 files changed, 15 insertions(+)
diff
: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
hw/net/vhost_net.c | 48 +
include/net/vhost_net.h | 2 ++
2 files changed, 50 insertions(+)
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index aa60dd901c..2ab67e875e 100644
--- a/hw/net/vhost_net.c
Update vhost_dev_virtqueue_restart() for vhost-user scenario.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
hw/virtio/vhost.c | 26 ++
1 file changed, 22 insertions(+), 4 deletions(-)
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index a0d6824353
Introduce vhost_virtqueue_stop(), which can reset the virtqueue
in the device. Then it will unmap vrings and the desc of the
virtqueue.
This patch only considers the case for vhost-kernel, when
NetClientDriver is NET_CLIENT_DRIVER_TAP.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
hw
The interface to set enable status for a single vring is lacked in
VhostOps, since the vhost_set_vring_enable_op will manipulate all
virtqueues in a device.
Resetting a single vq will rely on this interface.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
hw/virtio/vhost-user.c
Introduce the interface vhost_reset_vring(). The interface is a wrapper
to send a VHOST_USER_RESET_VRING message to the back-end. It will reset
an individual vring in the back-end. Meanwhile, it will wait for a reply
to ensure the reset has been completed.
Signed-off-by: Kangjie Xu
Signed-off-by
vhost
is not started and all vqs are not initalized until
VIRTIO_PCI_COMMON_STATUS is written. Thus, we should use vhost_started
to differentiate the two cases: vq reset and device start.
Currently it only supports vhost-user and vhost-kernel.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
Update vhost_dev_virtqueue_stop() for vhost-user scenario.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
hw/virtio/vhost.c | 19 +++
1 file changed, 19 insertions(+)
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index fc3f550c76..a0d6824353 100644
--- a/hw/virtio
From: Xuan Zhuo
virtio-net, vhost-kernel, vhost-user implement queue reset.
Queued packets in the corresponding queue pair are flushed
or purged.
Signed-off-by: Xuan Zhuo
Signed-off-by: Kangjie Xu
---
hw/net/virtio-net.c | 19 +++
1 file changed, 19 insertions(+)
diff --git
Update vhost_net_virtqueue_stop() for vhost-user scenario.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
hw/net/vhost_net.c | 4
1 file changed, 4 insertions(+)
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index 2ab67e875e..c0d408f3b4 100644
--- a/hw/net/vhost_net.c
Add virtqueue reset feature for vhost-user.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
hw/net/vhost_net.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index 9ea160e4e9..5bc89f2842 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net
Introduce the fucntion flush_or_purge_queued_packets(), it will be
used in device reset and virtqueue reset. Therefore, we extract the
common logic as a new function.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
hw/net/virtio-net.c | 17 +++--
1 file changed, 11
Update vhost_net_virtqueue_restart() for vhost-user scenario.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
hw/net/vhost_net.c | 4
1 file changed, 4 insertions(+)
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index c0d408f3b4..778081e54a 100644
--- a/hw/net/vhost_net.c
在 2022/8/16 14:22, Michael S. Tsirkin 写道:
On Tue, Aug 16, 2022 at 02:15:57PM +0800, Xuan Zhuo wrote:
On Tue, 16 Aug 2022 02:14:10 -0400, "Michael S. Tsirkin"
wrote:
On Tue, Aug 16, 2022 at 09:06:12AM +0800, Kangjie Xu wrote:
The virtio queue reset function has already been defi
patch set, thanks. :)
Best regards,
Kangjie
在 2022/8/16 09:06, Kangjie Xu 写道:
The virtio queue reset function has already been defined in the virtio spec 1.2.
The relevant virtio spec information is here:
https://github.com/oasis-tcs/virtio-spec/issues/124
https://github.com/oasis
在 2022/8/23 15:34, Jason Wang 写道:
在 2022/8/16 09:06, Kangjie Xu 写道:
A a new command line parameter "queue_reset" is added.
Meanwhile, the vq reset feature is disabled for pre-7.1 machines.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
hw/core/machine.c | 1 +
在 2022/8/23 15:40, Jason Wang 写道:
在 2022/8/16 09:06, Kangjie Xu 写道:
From: Xuan Zhuo
PCI devices support vq reset.
Based on this function, the driver can adjust the size of the ring, and
quickly recycle the buffer in the ring.
The migration of the virtio devices will not happen during a
在 2022/8/23 15:52, Jason Wang 写道:
在 2022/8/16 09:06, Kangjie Xu 写道:
Introduce vhost_dev_virtqueue_stop(), which can ummap the
vrings and the desc of it.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
hw/virtio/vhost.c | 9 +
include/hw/virtio/vhost.h | 3 +++
2
在 2022/8/23 15:44, Jason Wang 写道:
在 2022/8/16 09:06, Kangjie Xu 写道:
PCI devices support vq enable.
Nit: it might be "support device specific vq enable"
Get it.
Based on this function, the driver can re-enable the virtqueue after the
virtqueue is reset.
Signed-off-by:
在 2022/8/24 10:37, Jason Wang 写道:
在 2022/8/16 09:06, Kangjie Xu 写道:
Introduce vhost_dev_virtqueue_restart(), which can restart the
virtqueue when the vhost has already started running.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
hw/virtio/vhost.c | 13
在 2022/8/24 10:40, Jason Wang 写道:
在 2022/8/16 09:06, Kangjie Xu 写道:
Introduce vhost_virtqueue_stop(), which can reset the virtqueue
in the device. Then it will unmap vrings and the desc of the
virtqueue.
This patch only considers the case for vhost-kernel, when
NetClientDriver is
在 2022/8/24 10:44, Jason Wang 写道:
在 2022/8/16 09:06, Kangjie Xu 写道:
Introduce vhost_net_virtqueue_restart(), which can restart the
virtqueue when the vhost net started running before. If it fails
to restart the virtqueue, the device will be stopped.
This patch only considers the case for
在 2022/8/24 10:50, Jason Wang 写道:
在 2022/8/16 09:06, Kangjie Xu 写道:
Introduce the interface vhost_reset_vring(). The interface is a wrapper
to send a VHOST_USER_RESET_VRING message to the back-end. It will reset
an individual vring in the back-end. Meanwhile, it will wait for a reply
to
在 2022/8/24 10:53, Jason Wang 写道:
在 2022/8/16 09:06, Kangjie Xu 写道:
The interface to set enable status for a single vring is lacked in
VhostOps, since the vhost_set_vring_enable_op will manipulate all
virtqueues in a device.
Resetting a single vq will rely on this interface.
Signed-off-by
在 2022/8/24 10:40, Jason Wang 写道:
在 2022/8/16 09:06, Kangjie Xu 写道:
Introduce vhost_virtqueue_stop(), which can reset the virtqueue
in the device. Then it will unmap vrings and the desc of the
virtqueue.
This patch only considers the case for vhost-kernel, when
NetClientDriver is
在 2022/8/24 12:05, Jason Wang 写道:
在 2022/8/16 09:06, Kangjie Xu 写道:
Update vhost_net_virtqueue_stop() for vhost-user scenario.
Let's explain why it is needed now or why it doesn't cause any issue
or it's a bug fix or not.
Thanks
This patch is to suppport vq reset for
在 2022/8/24 11:56, Jason Wang 写道:
在 2022/8/16 09:06, Kangjie Xu 写道:
Update vhost_dev_virtqueue_stop() for vhost-user scenario.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
hw/virtio/vhost.c | 19 +++
1 file changed, 19 insertions(+)
diff --git a/hw/virtio
在 2022/8/24 12:03, Jason Wang 写道:
在 2022/8/16 09:06, Kangjie Xu 写道:
Update vhost_dev_virtqueue_restart() for vhost-user scenario.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
hw/virtio/vhost.c | 26 ++
1 file changed, 22 insertions(+), 4 deletions
在 2022/8/24 17:01, Jason Wang 写道:
在 2022/8/24 10:53, Kangjie Xu 写道:
在 2022/8/24 10:44, Jason Wang 写道:
在 2022/8/16 09:06, Kangjie Xu 写道:
Introduce vhost_net_virtqueue_restart(), which can restart the
virtqueue when the vhost net started running before. If it fails
to restart the virtqueue
在 2022/8/24 17:04, Jason Wang 写道:
在 2022/8/24 12:57, Kangjie Xu 写道:
在 2022/8/24 12:05, Jason Wang 写道:
在 2022/8/16 09:06, Kangjie Xu 写道:
Update vhost_net_virtqueue_stop() for vhost-user scenario.
Let's explain why it is needed now or why it doesn't cause any issue
or it'
在 2022/8/24 17:02, Jason Wang 写道:
在 2022/8/24 11:09, Kangjie Xu 写道:
在 2022/8/24 10:53, Jason Wang 写道:
在 2022/8/16 09:06, Kangjie Xu 写道:
The interface to set enable status for a single vring is lacked in
VhostOps, since the vhost_set_vring_enable_op will manipulate all
virtqueues in a
在 2022/8/24 16:59, Jason Wang 写道:
在 2022/8/23 16:20, Kangjie Xu 写道:
在 2022/8/23 15:44, Jason Wang 写道:
在 2022/8/16 09:06, Kangjie Xu 写道:
PCI devices support vq enable.
Nit: it might be "support device specific vq enable"
Get it.
Based on this function, the driver can re-
在 2022/8/25 10:52, Jason Wang 写道:
On Wed, Aug 24, 2022 at 7:27 PM Kangjie Xu wrote:
在 2022/8/24 16:59, Jason Wang 写道:
在 2022/8/23 16:20, Kangjie Xu 写道:
在 2022/8/23 15:44, Jason Wang 写道:
在 2022/8/16 09:06, Kangjie Xu 写道:
PCI devices support vq enable.
Nit: it might be "su
Expose vhost_virtqueue_start(), we need to use it when restarting a
virtqueue.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
hw/virtio/vhost.c | 8
include/hw/virtio/vhost.h | 2 ++
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/hw/virtio/vhost.c b/hw
mem table and features
do not change, so we can call the vhost_virtqueue_start() to
restart a specific queue.
This patch only considers the case of vhost-kernel, when
NetClientDriver is NET_CLIENT_DRIVER_TAP.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
hw/net/vhost_net.c | 52
. Migration
thread also needs the lock. As a result, when migration of virtio
devices starts, the 'reset' status of VirtIOPCIQueue will always be 0.
Thus, we do not need to add it in vmstate_virtio_pci_modern_queue_state.
Signed-off-by: Xuan Zhuo
Signed-off-by: Kangjie Xu
---
hw/virtio/vi
Introduce the fucntion flush_or_purge_queued_packets(), it will be
used in device reset and virtqueue reset. Therefore, we extract the
common logic as a new function.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
hw/net/virtio-net.c | 17 +++--
1 file changed, 11
from here:
https://github.com/oasis-tcs/virtio-spec/issues/89
Signed-off-by: Xuan Zhuo
Signed-off-by: Kangjie Xu
---
include/standard-headers/linux/virtio_config.h | 5 +
include/standard-headers/linux/virtio_pci.h| 2 ++
2 files changed, 7 insertions(+)
diff --git a/include/standard
Introduce vhost_virtqueue_unmap() to ummap the vrings and desc
of a virtqueue.
The function will be re-used when resetting a virtqueue.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
Acked-by: Jason Wang
---
hw/virtio/vhost.c | 20 ++--
include/hw/virtio/vhost.h
From: Xuan Zhuo
Introduce a new interface function virtio_queue_reset() to implement
reset for vq.
Add a new callback to VirtioDeviceClass for queue reset operation for
each child device.
Signed-off-by: Xuan Zhuo
Acked-by: Jason Wang
---
hw/virtio/virtio.c | 11 +++
include/h
start the virtqueue when DRIVER_OK.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
Acked-by: Jason Wang
---
hw/virtio/virtio.c | 14 ++
include/hw/virtio/virtio.h | 2 ++
2 files changed, 16 insertions(+)
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index
it may stop the device in the
backend.
This patch only considers the case of vhost-kernel, when
NetClientDriver is NET_CLIENT_DRIVER_TAP.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
hw/net/vhost_net.c | 22 ++
include/net/vhost_net.h | 2 ++
2 files changed
A a new command line parameter "queue_reset" is added.
Meanwhile, the vq reset feature is disabled for pre-7.1 machines.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
hw/core/machine.c | 1 +
include/hw/virtio/virtio.h | 4 +++-
2 files changed, 4 insertions(+),
PCI devices support device specific vq enable.
Based on this function, the driver can re-enable the virtqueue after the
virtqueue is reset.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
hw/virtio/virtio-pci.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/virtio/virtio-pci.c
From: Xuan Zhuo
virtio-net and vhost-kernel implement queue reset.
Queued packets in the corresponding queue pair are flushed
or purged.
Signed-off-by: Xuan Zhuo
Signed-off-by: Kangjie Xu
---
hw/net/virtio-net.c | 18 ++
1 file changed, 18 insertions(+)
diff --git a/hw/net
From: Xuan Zhuo
Separate the logic of vq reset. This logic will be called directly
later.
Signed-off-by: Xuan Zhuo
Acked-by: Jason Wang
---
hw/virtio/virtio.c | 37 +
1 file changed, 21 insertions(+), 16 deletions(-)
diff --git a/hw/virtio/virtio.c b/hw/vi
ser message VHOST_USER_RESET_VRING.
3. Add migration compatibility for virtqueue reset.
Kangjie Xu (10):
virtio: introduce virtio_queue_enable()
virtio: core: vq reset feature negotation support
virtio-pci: support queue enable
vhost: extract the logic of unmapping the vrings and de
initalized until VIRTIO_PCI_COMMON_STATUS
is written. Thus, we should use vhost_started to differentiate the
two cases: vq reset and device start.
Currently it only supports vhost-kernel.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
hw/net/virtio-net.c | 21 +
1 file
Add virtqueue reset feature for vhost-kernel.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
hw/net/vhost_net.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index 0716f6cd96..74c5147d6e 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net
/T/#t)
1. rename vhost_set_vring_enable to vhost_set_dev_enable.
2. add vhost-user message VHOST_USER_RESET_VRING
3. remove restart/reset functions of virtqueue in vhost module.
Kangjie Xu (8):
docs: vhost-user: add VHOST_USER_RESET_VRING message
net: virtio: rename vhost_set_vring_enable to vh
-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
docs/interop/vhost-user.rst | 10 ++
1 file changed, 10 insertions(+)
diff --git a/docs/interop/vhost-user.rst b/docs/interop/vhost-user.rst
index 3f18ab424e..ce7991b9d3 100644
--- a/docs/interop/vhost-user.rst
+++ b/docs/interop/vhost
There is only vhost_set_dev_enable op in VhostOps. Thus, we introduce
the interface vhost_set_vring_enable to set the enable status for a
single vring.
Resetting a single vq will rely on this interface.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
hw/virtio/vhost-user.c
Add virtqueue reset feature for vhost-user.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
hw/net/vhost_net.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index 13b9c11e68..745cb4375b 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net
Previously, vhost_set_vring_enable will enable/disable all vrings
in a device, which causes ambiguity. So we rename it to
vhost_set_dev_enable.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
backends/cryptodev-vhost.c| 12 ++--
hw/net/vhost_net-stub.c | 2
Update vhost_net_virtqueue_reset() for vhost-user scenario.
In order to reuse some functions, we process the idx for
vhost-user scenario because vhost_get_vq_index behave
differently for vhost-user.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
hw/net/vhost_net.c | 13
Update virtio_net_queue_reset() and virtio_net_queue_enable()
for vhost-user scenario.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
hw/net/virtio-net.c | 6 --
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 6ab796b399
Introduce the interface vhost_reset_vring(). The interface is a wrapper
to send a VHOST_USER_RESET_VRING message to the back-end. It will reset
an individual vring in the back-end. Meanwhile, it will wait for a reply
to ensure the reset has been completed.
Signed-off-by: Kangjie Xu
Signed-off-by
Update vhost_net_virtqueue_restart() for vhost-user scenario.
In order to reuse some functions, we process the idx for
vhost-user case. It is because vhost_get_vq_index behave
differently in vhost-user.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
hw/net/vhost_net.c | 12
Do you have any comments about this patch set?
Thanks
在 2022/8/25 16:08, Kangjie Xu 写道:
The virtio queue reset function has already been defined in the virtio spec 1.2.
The relevant virtio spec information is here:
https://github.com/oasis-tcs/virtio-spec/issues/124
https
Introduce the interface queue_enable() in VirtioDeviceClass and the
fucntion virtio_queue_enable() in virtio, it can be called when
VIRTIO_PCI_COMMON_Q_ENABLE is written.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
hw/virtio/virtio-pci.c | 1 +
hw/virtio/virtio.c | 9
://lore.kernel.org/bpf/20220629065656.54420-1-xuanz...@linux.alibaba.com/
DPDK Code:
https://github.com/middaywords/dpdk/commit/098c8e1dfae10b747da8dd8950a82890efca7bee
Please review. Thanks.
Kangjie Xu (9):
vhost: add op to enable or disable a single vring
vhost-user: enable/disable a single vring
From: Xuan Zhuo
Add queue_notify_data in struct virtio_pci_common_cfg, which comes from
here https://github.com/oasis-tcs/virtio-spec/issues/89
Since I want to add queue_reset after queue_notify_data, I submitted
this patch first.
Signed-off-by: Xuan Zhuo
---
include/standard-headers/linux/vi
From: Xuan Zhuo
virtio-net implements queue reset. Queued packets in the corresponding
queue pair are flushed or purged.
Queue reset is currently only implemented for non-vhosts.
Signed-off-by: Xuan Zhuo
---
hw/net/virtio-net.c | 15 +++
1 file changed, 15 insertions(+)
diff --gi
From: Xuan Zhuo
Add queue_reset in virtio_pci_common_cfg.
Signed-off-by: Xuan Zhuo
---
include/standard-headers/linux/virtio_pci.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/standard-headers/linux/virtio_pci.h
b/include/standard-headers/linux/virtio_pci.h
index 598ebe9825..
From: Xuan Zhuo
PCI devices support vq reset.
Based on this function, the driver can adjust the size of the ring, and
quickly recycle the buffer in the ring.
Signed-off-by: Xuan Zhuo
---
hw/virtio/virtio-pci.c | 16
include/hw/virtio/virtio-pci.h | 1 +
2 files chang
From: Xuan Zhuo
Introduce a new interface function virtio_queue_reset() to implement
reset for vq.
Add a new callback to VirtioDeviceClass for queue reset operation for
each child device.
Signed-off-by: Xuan Zhuo
---
hw/virtio/virtio.c | 11 +++
include/hw/virtio/virtio.h | 2
, wait_for_reply, is added.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
include/hw/virtio/vhost-backend.h | 4
1 file changed, 4 insertions(+)
diff --git a/include/hw/virtio/vhost-backend.h
b/include/hw/virtio/vhost-backend.h
index eab46d7f0b..7bddd1e9a0 100644
--- a/include/hw
Introduce vhost_virtqueue_unmap() to ummap the vrings and desc
of a virtqueue.
The function will be used later.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
hw/virtio/vhost.c | 20 ++--
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/hw/virtio/vhost.c
started vhost.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
hw/virtio/vhost.c | 29 +
include/hw/virtio/vhost.h | 6 ++
2 files changed, 35 insertions(+)
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index e467dfc7bc..d158d71866 100644
--- a/hw
From: Xuan Zhuo
Separate the logic of vq reset. This logic will be called directly
later.
Signed-off-by: Xuan Zhuo
---
hw/virtio/virtio.c | 37 +
1 file changed, 21 insertions(+), 16 deletions(-)
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 5d
two functions, we can reset a virtqueue with a
started vhost net.
Signed-off-by: Kangjie Xu
Signed-off-by: Xuan Zhuo
---
hw/net/vhost_net.c | 55 +
include/net/vhost_net.h | 5
2 files changed, 60 insertions(+)
diff --git a/hw/net/vhost_net.c b
1 - 100 of 133 matches
Mail list logo