Re: [PATCH v13 32/42] virtio_pci: support VIRTIO_F_RING_RESET

2022-07-26 Thread Jason Wang
在 2022/7/26 15:22, Xuan Zhuo 写道: This patch implements virtio pci support for QUEUE RESET. Performing reset on a queue is divided into these steps: 1. notify the device to reset the queue 2. recycle the buffer submitted 3. reset the vring (may re-alloc) 4. mmap vring to device, and

Re: [PATCH v13 22/42] virtio_ring: packed: introduce virtqueue_reinit_packed()

2022-07-26 Thread Jason Wang
在 2022/7/26 15:22, Xuan Zhuo 写道: Introduce a function to initialize vq without allocating new ring, desc_state, desc_extra. Subsequent patches will call this function after reset vq to reinitialize vq. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c |

Re: [PATCH v13 21/42] virtio_ring: packed: extract the logic of attach vring

2022-07-26 Thread Jason Wang
在 2022/7/26 15:22, Xuan Zhuo 写道: Separate the logic of attach vring, the subsequent patch will call it separately. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 19 +++ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git

Re: [PATCH v13 20/42] virtio_ring: packed: extract the logic of vring init

2022-07-26 Thread Jason Wang
在 2022/7/26 15:22, Xuan Zhuo 写道: Separate the logic of initializing vring, and subsequent patches will call it separately. This function completes the variable initialization of packed vring. It together with the logic of atatch constitutes the initialization of vring. Signed-off-by: Xuan

Re: [PATCH v13 19/42] virtio_ring: packed: extract the logic of alloc state and extra

2022-07-26 Thread Jason Wang
在 2022/7/26 15:22, Xuan Zhuo 写道: Separate the logic for alloc desc_state and desc_extra, which will be called separately by subsequent patches. Use struct vring_packed to pass desc_state, desc_extra. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 48

Re: [PATCH v13 18/42] virtio_ring: packed: extract the logic of alloc queue

2022-07-26 Thread Jason Wang
在 2022/7/26 15:22, Xuan Zhuo 写道: Separate the logic of packed to create vring queue. This feature is required for subsequent virtuqueue reset vring. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 80 +++- 1 file

Re: [PATCH v13 17/42] virtio_ring: packed: introduce vring_free_packed

2022-07-26 Thread Jason Wang
在 2022/7/26 15:22, Xuan Zhuo 写道: Free the structure struct vring_vritqueue_packed. Subsequent patches require it. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 22 ++ 1 file changed, 22 insertions(+) diff --git

Re: [PATCH v13 11/42] virtio_ring: split: extract the logic of alloc state and extra

2022-07-26 Thread Jason Wang
在 2022/7/26 15:21, Xuan Zhuo 写道: Separate the logic of creating desc_state, desc_extra, and subsequent patches will call it independently. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 51 +--- 1 file changed, 35

RE: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0

2022-07-26 Thread Parav Pandit via Virtualization
> From: Zhu, Lingshan > Sent: Tuesday, July 26, 2022 10:53 PM > > On 7/27/2022 10:17 AM, Parav Pandit wrote: > >> From: Zhu, Lingshan > >> Sent: Tuesday, July 26, 2022 10:15 PM > >> > >> On 7/26/2022 11:56 PM, Parav Pandit wrote: > From: Zhu, Lingshan > Sent: Tuesday, July 12, 2022

Re: [PATCH v13 10/42] virtio_ring: split: extract the logic of alloc queue

2022-07-26 Thread Jason Wang
在 2022/7/26 15:21, Xuan Zhuo 写道: Separate the logic of split to create vring queue. This feature is required for subsequent virtuqueue reset vring. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 65 ++-- 1 file

Re: [PATCH v13 16/42] virtio_ring: split: introduce virtqueue_resize_split()

2022-07-26 Thread Jason Wang
在 2022/7/26 15:21, Xuan Zhuo 写道: virtio ring split supports resize. Only after the new vring is successfully allocated based on the new num, we will release the old vring. In any case, an error is returned, indicating that the vring still points to the old vring. In the case of an error,

Re: [PATCH v13 08/42] virtio_ring: split: __vring_new_virtqueue() accept struct vring_virtqueue_split

2022-07-26 Thread Jason Wang
在 2022/7/26 15:21, Xuan Zhuo 写道: __vring_new_virtqueue() instead accepts struct vring_virtqueue_split. The purpose of this is to pass more information into __vring_new_virtqueue() to make the code simpler and the structure cleaner. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang ---

Re: [PATCH v13 07/42] virtio_ring: split: stop __vring_new_virtqueue as export symbol

2022-07-26 Thread Jason Wang
在 2022/7/26 15:21, Xuan Zhuo 写道: There is currently only one place to reference __vring_new_virtqueue() directly from the outside of virtio core. And here vring_new_virtqueue() can be used instead. Subsequent patches will modify __vring_new_virtqueue, so stop it as an export symbol for now.

RE: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0

2022-07-26 Thread Parav Pandit via Virtualization
> From: Zhu, Lingshan > Sent: Tuesday, July 26, 2022 10:15 PM > > On 7/26/2022 11:56 PM, Parav Pandit wrote: > >> From: Zhu, Lingshan > >> Sent: Tuesday, July 12, 2022 11:46 PM > >>> When the user space which invokes netlink commands, detects that > _MQ > >> is not supported, hence it takes

RE: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0

2022-07-26 Thread Parav Pandit via Virtualization
> From: Michael S. Tsirkin > Sent: Tuesday, July 26, 2022 3:49 PM > > On Tue, Jul 26, 2022 at 03:54:06PM +, Parav Pandit wrote: > > > > > From: Michael S. Tsirkin > > > Sent: Wednesday, July 13, 2022 1:27 AM > > > > > > On Fri, Jul 01, 2022 at 10:07:59PM +, Parav Pandit wrote: > > > >

RE: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0

2022-07-26 Thread Parav Pandit via Virtualization
> From: Michael S. Tsirkin > Sent: Tuesday, July 26, 2022 3:52 PM > > On Tue, Jul 26, 2022 at 03:56:32PM +, Parav Pandit wrote: > > > > > From: Zhu, Lingshan > > > Sent: Tuesday, July 12, 2022 11:46 PM > > > > When the user space which invokes netlink commands, detects that > > > > _MQ > >

Re: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0

2022-07-26 Thread Michael S. Tsirkin
On Tue, Jul 26, 2022 at 03:56:32PM +, Parav Pandit wrote: > > > From: Zhu, Lingshan > > Sent: Tuesday, July 12, 2022 11:46 PM > > > When the user space which invokes netlink commands, detects that _MQ > > is not supported, hence it takes max_queue_pair = 1 by itself. > > I think the kernel

Re: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0

2022-07-26 Thread Michael S. Tsirkin
On Tue, Jul 26, 2022 at 03:54:06PM +, Parav Pandit wrote: > > > From: Michael S. Tsirkin > > Sent: Wednesday, July 13, 2022 1:27 AM > > > > On Fri, Jul 01, 2022 at 10:07:59PM +, Parav Pandit wrote: > > > > > > > > > > From: Zhu Lingshan > > > > Sent: Friday, July 1, 2022 9:28 AM > > >

Re: [PATCH] VMCI: Update maintainers for VMCI

2022-07-26 Thread Vishnu Dasa via Virtualization
> On Jul 26, 2022, at 9:18 AM, Joe Perches wrote: > > On Tue, 2022-07-26 at 15:55 +, Vishnu Dasa wrote: >>> On Jul 26, 2022, at 8:10 AM, Greg KH >> On Mon, Jul 25, 2022 at 06:29:25PM +, Vishnu Dasa wrote: > On Jul 25, 2022, at 11:05 AM, Greg KH wrote: > On Mon, Jul 25, 2022

Re: [PATCH] VMCI: Update maintainers for VMCI

2022-07-26 Thread Joe Perches
On Tue, 2022-07-26 at 15:55 +, Vishnu Dasa wrote: > > On Jul 26, 2022, at 8:10 AM, Greg KH > On Mon, Jul 25, 2022 at 06:29:25PM +, Vishnu Dasa wrote: > > > > On Jul 25, 2022, at 11:05 AM, Greg KH > > > > wrote: > > > > On Mon, Jul 25, 2022 at 09:32:46AM -0700, vd...@vmware.com wrote: >

RE: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0

2022-07-26 Thread Parav Pandit via Virtualization
> From: Zhu, Lingshan > Sent: Tuesday, July 12, 2022 11:46 PM > > When the user space which invokes netlink commands, detects that _MQ > is not supported, hence it takes max_queue_pair = 1 by itself. > I think the kernel module have all necessary information and it is the only > one which have

Re: [PATCH] VMCI: Update maintainers for VMCI

2022-07-26 Thread Vishnu Dasa via Virtualization
> On Jul 26, 2022, at 8:10 AM, Greg KH wrote: > > On Mon, Jul 25, 2022 at 06:29:25PM +, Vishnu Dasa wrote: >> >>> On Jul 25, 2022, at 11:05 AM, Greg KH wrote: >>> >>> On Mon, Jul 25, 2022 at 09:32:46AM -0700, vd...@vmware.com wrote: From: Vishnu Dasa Remove Rajesh as a

RE: [PATCH V3 5/6] vDPA: answer num of queue pairs = 1 to userspace when VIRTIO_NET_F_MQ == 0

2022-07-26 Thread Parav Pandit via Virtualization
> From: Michael S. Tsirkin > Sent: Wednesday, July 13, 2022 1:27 AM > > On Fri, Jul 01, 2022 at 10:07:59PM +, Parav Pandit wrote: > > > > > > > From: Zhu Lingshan > > > Sent: Friday, July 1, 2022 9:28 AM > > > If VIRTIO_NET_F_MQ == 0, the virtio device should have one queue > > > pair, so

Re: [PATCH] VMCI: Update maintainers for VMCI

2022-07-26 Thread Greg KH
On Mon, Jul 25, 2022 at 06:29:25PM +, Vishnu Dasa wrote: > > > On Jul 25, 2022, at 11:05 AM, Greg KH wrote: > > > > On Mon, Jul 25, 2022 at 09:32:46AM -0700, vd...@vmware.com wrote: > >> From: Vishnu Dasa > >> > >> Remove Rajesh as a maintainer for the VMCI driver. > > > > Why? > >

Re: [RFC PATCH 1/1] drivers/vhost: vhost-blk accelerator for virtio-blk guests

2022-07-26 Thread Denis V. Lunev via Virtualization
On 26.07.2022 16:45, Michael S. Tsirkin wrote: On Mon, Jul 25, 2022 at 11:27:53PM +0300, Andrey Zhadchenko wrote: Although QEMU virtio is quite fast, there is still some room for improvements. Disk latency can be reduced if we handle virito-blk requests in host kernel istead of passing them to

Re: [RFC PATCH 1/1] drivers/vhost: vhost-blk accelerator for virtio-blk guests

2022-07-26 Thread Michael S. Tsirkin
On Mon, Jul 25, 2022 at 11:27:53PM +0300, Andrey Zhadchenko wrote: > Although QEMU virtio is quite fast, there is still some room for > improvements. Disk latency can be reduced if we handle virito-blk requests > in host kernel istead of passing them to QEMU. The patch adds vhost-blk > kernel

Re: [PATCH V4 3/6] vDPA: allow userspace to query features of a vDPA device

2022-07-26 Thread Zhu Lingshan
On 7/26/2022 7:06 PM, Parav Pandit via Virtualization wrote: From: Zhu, Lingshan Sent: Tuesday, July 26, 2022 7:03 AM On 7/24/2022 11:21 PM, Parav Pandit wrote: From: Zhu, Lingshan Sent: Saturday, July 23, 2022 7:24 AM On 7/22/2022 9:12 PM, Parav Pandit wrote: From: Zhu Lingshan Sent:

RE: [PATCH V4 3/6] vDPA: allow userspace to query features of a vDPA device

2022-07-26 Thread Parav Pandit via Virtualization
> From: Zhu, Lingshan > Sent: Tuesday, July 26, 2022 7:03 AM > > On 7/24/2022 11:21 PM, Parav Pandit wrote: > > > >> From: Zhu, Lingshan > >> Sent: Saturday, July 23, 2022 7:24 AM > >> > >> > >> On 7/22/2022 9:12 PM, Parav Pandit wrote: > From: Zhu Lingshan > Sent: Friday, July 22,

Re: [RFC 4/5] virtio: get desc id in order

2022-07-26 Thread Jason Wang
在 2022/7/21 16:43, Guo Zhi 写道: If in order feature negotiated, we can skip the used ring to get buffer's desc id sequentially. Let's rename the patch to something like "in order support for virtio_ring" Signed-off-by: Guo Zhi --- drivers/virtio/virtio_ring.c | 37

Re: [RFC 1/5] vhost: reorder used descriptors in a batch

2022-07-26 Thread Jason Wang
在 2022/7/21 16:43, Guo Zhi 写道: Device may not use descriptors in order, for example, NIC and SCSI may not call __vhost_add_used_n with buffers in order. It's the task of __vhost_add_used_n to order them. I'm not sure this is ture. Having ooo descriptors is probably by design to have better

[PATCH v13 42/42] virtio_net: support set_ringparam

2022-07-26 Thread Xuan Zhuo
Support set_ringparam based on virtio queue reset. Users can use ethtool -G eth0 to modify the ring size of virtio-net. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 48 1 file changed, 48 insertions(+) diff --git

[PATCH v13 39/42] virtio_net: split free_unused_bufs()

2022-07-26 Thread Xuan Zhuo
This patch separates two functions for freeing sq buf and rq buf from free_unused_bufs(). When supporting the enable/disable tx/rq queue in the future, it is necessary to support separate recovery of a sq buf or a rq buf. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang ---

[PATCH v13 41/42] virtio_net: support tx queue resize

2022-07-26 Thread Xuan Zhuo
This patch implements the resize function of the tx queues. Based on this function, it is possible to modify the ring num of the queue. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 47 1 file changed, 47 insertions(+)

[PATCH v13 40/42] virtio_net: support rx queue resize

2022-07-26 Thread Xuan Zhuo
This patch implements the resize function of the rx queues. Based on this function, it is possible to modify the ring num of the queue. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 22 ++ 1 file changed, 22 insertions(+) diff --git

[PATCH v13 38/42] virtio_net: get ringparam by virtqueue_get_vring_max_size()

2022-07-26 Thread Xuan Zhuo
Use virtqueue_get_vring_max_size() in virtnet_get_ringparam() to set tx,rx_max_pending. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/net/virtio_net.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c

[PATCH v13 37/42] virtio_net: set the default max ring size by find_vqs()

2022-07-26 Thread Xuan Zhuo
Use virtio_find_vqs_ctx_size() to specify the maximum ring size of tx, rx at the same time. | rx/tx ring size --- speed == UNKNOWN or < 10G| 1024 speed < 40G | 4096 speed >= 40G | 8192 Call

[PATCH v13 36/42] virtio: add helper virtio_find_vqs_ctx_size()

2022-07-26 Thread Xuan Zhuo
Introduce helper virtio_find_vqs_ctx_size() to call find_vqs and specify the maximum size of each vq ring. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- include/linux/virtio_config.h | 12 1 file changed, 12 insertions(+) diff --git a/include/linux/virtio_config.h

[PATCH v13 35/42] virtio_mmio: support the arg sizes of find_vqs()

2022-07-26 Thread Xuan Zhuo
Virtio MMIO support the new parameter sizes of find_vqs(). Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_mmio.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c index

[PATCH v13 34/42] virtio_pci: support the arg sizes of find_vqs()

2022-07-26 Thread Xuan Zhuo
Virtio PCI supports new parameter sizes of find_vqs(). Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_pci_common.c | 18 ++ drivers/virtio/virtio_pci_common.h | 1 + drivers/virtio/virtio_pci_legacy.c | 6 +- drivers/virtio/virtio_pci_modern.c |

[PATCH v13 33/42] virtio: find_vqs() add arg sizes

2022-07-26 Thread Xuan Zhuo
find_vqs() adds a new parameter sizes to specify the size of each vq vring. NULL as sizes means that all queues in find_vqs() use the maximum size. A value in the array is 0, which means that the corresponding queue uses the maximum size. In the split scenario, the meaning of size is the largest

[PATCH v13 32/42] virtio_pci: support VIRTIO_F_RING_RESET

2022-07-26 Thread Xuan Zhuo
This patch implements virtio pci support for QUEUE RESET. Performing reset on a queue is divided into these steps: 1. notify the device to reset the queue 2. recycle the buffer submitted 3. reset the vring (may re-alloc) 4. mmap vring to device, and enable the queue This patch implements

[PATCH v13 27/42] virtio: queue_reset: add VIRTIO_F_RING_RESET

2022-07-26 Thread Xuan Zhuo
Added VIRTIO_F_RING_RESET, it came from here https://github.com/oasis-tcs/virtio-spec/issues/124 https://github.com/oasis-tcs/virtio-spec/issues/139 This feature indicates that the driver can reset a queue individually. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang ---

[PATCH v13 31/42] virtio_pci: extract the logic of active vq for modern pci

2022-07-26 Thread Xuan Zhuo
Introduce vp_active_vq() to configure vring to backend after vq attach vring. And configure vq vector if necessary. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_pci_modern.c | 46 ++ 1 file changed, 28 insertions(+), 18 deletions(-) diff

[PATCH v13 30/42] virtio_pci: introduce helper to get/set queue reset

2022-07-26 Thread Xuan Zhuo
Introduce new helpers to implement queue reset and get queue reset status. https://github.com/oasis-tcs/virtio-spec/issues/124 https://github.com/oasis-tcs/virtio-spec/issues/139 Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_pci_modern_dev.c | 39

[PATCH v13 29/42] virtio_pci: struct virtio_pci_common_cfg add queue_reset

2022-07-26 Thread Xuan Zhuo
Add queue_reset in virtio_pci_common_cfg. https://github.com/oasis-tcs/virtio-spec/issues/124 https://github.com/oasis-tcs/virtio-spec/issues/139 Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- include/linux/virtio_pci_modern.h | 2 +- include/uapi/linux/virtio_pci.h | 1 + 2 files

[PATCH v13 28/42] virtio_ring: struct virtqueue introduce reset

2022-07-26 Thread Xuan Zhuo
Introduce a new member reset to the structure virtqueue to determine whether the current vq is in the reset state. Subsequent patches will use it. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 2 ++ include/linux/virtio.h | 2 ++ 2 files changed, 4

[PATCH v13 26/42] virtio: allow to unbreak/break virtqueue individually

2022-07-26 Thread Xuan Zhuo
This patch allows the new introduced __virtqueue_break()/__virtqueue_unbreak() to break/unbreak the virtqueue. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 24 include/linux/virtio.h | 3 +++ 2 files changed, 27 insertions(+)

[PATCH v13 25/42] virtio_pci: struct virtio_pci_common_cfg add queue_notify_data

2022-07-26 Thread 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 Acked-by: Jason Wang ---

[PATCH v13 24/42] virtio_ring: introduce virtqueue_resize()

2022-07-26 Thread Xuan Zhuo
Introduce virtqueue_resize() to implement the resize of vring. Based on these, the driver can dynamically adjust the size of the vring. For example: ethtool -G. virtqueue_resize() implements resize based on the vq reset function. In case of failure to allocate a new vring, it will give up resize

[PATCH v13 23/42] virtio_ring: packed: introduce virtqueue_resize_packed()

2022-07-26 Thread Xuan Zhuo
virtio ring packed supports resize. Only after the new vring is successfully allocated based on the new num, we will release the old vring. In any case, an error is returned, indicating that the vring still points to the old vring. In the case of an error, re-initialize(by

[PATCH v13 22/42] virtio_ring: packed: introduce virtqueue_reinit_packed()

2022-07-26 Thread Xuan Zhuo
Introduce a function to initialize vq without allocating new ring, desc_state, desc_extra. Subsequent patches will call this function after reset vq to reinitialize vq. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 21 + 1 file changed, 21 insertions(+) diff

[PATCH v13 21/42] virtio_ring: packed: extract the logic of attach vring

2022-07-26 Thread Xuan Zhuo
Separate the logic of attach vring, the subsequent patch will call it separately. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 19 +++ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index

[PATCH v13 20/42] virtio_ring: packed: extract the logic of vring init

2022-07-26 Thread Xuan Zhuo
Separate the logic of initializing vring, and subsequent patches will call it separately. This function completes the variable initialization of packed vring. It together with the logic of atatch constitutes the initialization of vring. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c

[PATCH v13 19/42] virtio_ring: packed: extract the logic of alloc state and extra

2022-07-26 Thread Xuan Zhuo
Separate the logic for alloc desc_state and desc_extra, which will be called separately by subsequent patches. Use struct vring_packed to pass desc_state, desc_extra. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 48 +--- 1 file changed, 34

[PATCH v13 17/42] virtio_ring: packed: introduce vring_free_packed

2022-07-26 Thread Xuan Zhuo
Free the structure struct vring_vritqueue_packed. Subsequent patches require it. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 22 ++ 1 file changed, 22 insertions(+) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index

[PATCH v13 18/42] virtio_ring: packed: extract the logic of alloc queue

2022-07-26 Thread Xuan Zhuo
Separate the logic of packed to create vring queue. This feature is required for subsequent virtuqueue reset vring. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 80 +++- 1 file changed, 51 insertions(+), 29 deletions(-) diff --git

[PATCH v13 16/42] virtio_ring: split: introduce virtqueue_resize_split()

2022-07-26 Thread Xuan Zhuo
virtio ring split supports resize. Only after the new vring is successfully allocated based on the new num, we will release the old vring. In any case, an error is returned, indicating that the vring still points to the old vring. In the case of an error, re-initialize(virtqueue_reinit_split())

[PATCH v13 14/42] virtio_ring: split: introduce virtqueue_reinit_split()

2022-07-26 Thread Xuan Zhuo
Introduce a function to initialize vq without allocating new ring, desc_state, desc_extra. Subsequent patches will call this function after reset vq to reinitialize vq. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 19 +++ 1 file changed, 19

[PATCH v13 13/42] virtio_ring: split: extract the logic of attach vring

2022-07-26 Thread Xuan Zhuo
Separate the logic of attach vring, subsequent patches will call it separately. virtqueue_vring_init_split() completes the initialization of other variables of vring split. We can directly use vq->split = *vring_split to complete attach. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang ---

[PATCH v13 15/42] virtio_ring: split: reserve vring_align, may_reduce_num

2022-07-26 Thread Xuan Zhuo
In vring_alloc_queue_split() save vring_align, may_reduce_num to structure vring_virtqueue_split. Used to create a new vring when implementing resize. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 10 ++ 1 file changed, 10 insertions(+) diff --git

[PATCH v13 12/42] virtio_ring: split: extract the logic of vring init

2022-07-26 Thread Xuan Zhuo
Separate the logic of initializing vring, and subsequent patches will call it separately. This function completes the variable initialization of split vring. It together with the logic of atatch constitutes the initialization of vring. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang ---

[PATCH v13 10/42] virtio_ring: split: extract the logic of alloc queue

2022-07-26 Thread Xuan Zhuo
Separate the logic of split to create vring queue. This feature is required for subsequent virtuqueue reset vring. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 65 ++-- 1 file changed, 40 insertions(+), 25 deletions(-) diff --git

[PATCH v13 11/42] virtio_ring: split: extract the logic of alloc state and extra

2022-07-26 Thread Xuan Zhuo
Separate the logic of creating desc_state, desc_extra, and subsequent patches will call it independently. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 51 +--- 1 file changed, 35 insertions(+), 16 deletions(-) diff --git

[PATCH v13 09/42] virtio_ring: split: introduce vring_free_split()

2022-07-26 Thread Xuan Zhuo
Free the structure struct vring_vritqueue_split. Subsequent patches require it. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index

[PATCH v13 08/42] virtio_ring: split: __vring_new_virtqueue() accept struct vring_virtqueue_split

2022-07-26 Thread Xuan Zhuo
__vring_new_virtqueue() instead accepts struct vring_virtqueue_split. The purpose of this is to pass more information into __vring_new_virtqueue() to make the code simpler and the structure cleaner. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_ring.c | 29 +++-- 1

[PATCH v13 06/42] virtio_ring: introduce virtqueue_init()

2022-07-26 Thread Xuan Zhuo
Separate the logic of virtqueue initialization. This logic is irrelevant to ring layout. This logic can be called independently when implementing resize/reset later. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 63 ++-- 1

[PATCH v13 07/42] virtio_ring: split: stop __vring_new_virtqueue as export symbol

2022-07-26 Thread Xuan Zhuo
There is currently only one place to reference __vring_new_virtqueue() directly from the outside of virtio core. And here vring_new_virtqueue() can be used instead. Subsequent patches will modify __vring_new_virtqueue, so stop it as an export symbol for now. Signed-off-by: Xuan Zhuo ---

[PATCH v13 04/42] virtio_ring: extract the logic of freeing vring

2022-07-26 Thread Xuan Zhuo
Introduce vring_free() to free the vring of vq. Subsequent patches will use vring_free() alone. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 18 +- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/virtio/virtio_ring.c

[PATCH v13 05/42] virtio_ring: split vring_virtqueue

2022-07-26 Thread Xuan Zhuo
Separate the two inline structures(split and packed) from the structure vring_virtqueue. In this way, we can use these two structures later to pass parameters and retain temporary variables. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 116

[PATCH v13 02/42] virtio: struct virtio_config_ops add callbacks for queue_reset

2022-07-26 Thread Xuan Zhuo
reset can be divided into the following four steps (example): 1. transport: notify the device to reset the queue 2. vring: recycle the buffer submitted 3. vring: reset/resize the vring (may re-alloc) 4. transport: mmap vring to device, and enable the queue In order to support queue

[PATCH v13 03/42] virtio_ring: update the document of the virtqueue_detach_unused_buf for queue reset

2022-07-26 Thread Xuan Zhuo
Added documentation for virtqueue_detach_unused_buf, allowing it to be called on queue reset. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- drivers/virtio/virtio_ring.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/virtio/virtio_ring.c

[PATCH v13 01/42] virtio: record the maximum queue num supported by the device.

2022-07-26 Thread Xuan Zhuo
virtio-net can display the maximum (supported by hardware) ring size in ethtool -g eth0. When the subsequent patch implements vring reset, it can judge whether the ring size passed by the driver is legal based on this. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang ---

[PATCH v13 00/42] virtio pci support VIRTIO_F_RING_RESET

2022-07-26 Thread Xuan Zhuo
The virtio spec already supports the virtio queue reset function. This patch set is to add this function to the kernel. The relevant virtio spec information is here: https://github.com/oasis-tcs/virtio-spec/issues/124 https://github.com/oasis-tcs/virtio-spec/issues/139 Also regarding