[RFC PATCH 0/5] vsock/virtio: Add support for multi-devices

2024-05-17 Thread Xuewei Niu
amp;host_port); n = write(fd, buffer); ``` # Use Cases We've completed a POC with Kata Containers, Ztunnel, which is a purpose-built per-node proxy for Istio ambient mesh, and TSI. Please refer to the following link for more details. Link: https://bit.ly/4bdPJbU Xuewei Niu (5): vsock/virtio:

[RFC PATCH 1/5] vsock/virtio: Extend virtio-vsock spec with an "order" field

2024-05-17 Thread Xuewei Niu
ce, but is required for the mode of multiple devices. Signed-off-by: Xuewei Niu --- include/uapi/linux/virtio_vsock.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/uapi/linux/virtio_vsock.h b/include/uapi/linux/virtio_vsock.h index 64738838bee5..b62ec7d2ab1e 100644 --- a/include/

[RFC PATCH 2/5] vsock/virtio: Add support for multi-devices

2024-05-17 Thread Xuewei Niu
The devices are inserted into the list when probing. The kernel will deny devices from being registered if there are conflicts existing in CIDs or orders. Signed-off-by: Xuewei Niu --- include/net/af_vsock.h | 16 ++ include/uapi/linux/vm_sockets.h | 6 + net/vmw_vsock

[RFC PATCH 3/5] vsock/virtio: can_msgzerocopy adapts to multi-devices

2024-05-17 Thread Xuewei Niu
Adds a new argument, named "cid", to let them know which `virtio_vsock` to be selected. Signed-off-by: Xuewei Niu --- include/linux/virtio_vsock.h| 2 +- net/vmw_vsock/virtio_transport.c| 5 ++--- net/vmw_vsock/virtio_transport_common.c | 6 +++--- 3 files

[RFC PATCH 4/5] vsock: seqpacket_allow adapts to multi-devices

2024-05-17 Thread Xuewei Niu
Adds a new argument, named "src_cid", to let them know which `virtio_vsock` to be selected. Signed-off-by: Xuewei Niu --- include/net/af_vsock.h | 2 +- net/vmw_vsock/af_vsock.c | 15 +-- net/vmw_vsock/virtio_transport.c | 4 ++-- net/vmw_vsock/vsock_

[RFC PATCH 5/5] vsock: Add an ioctl request to get all CIDs

2024-05-17 Thread Xuewei Niu
The new request is called `IOCTL_VM_SOCKETS_GET_LOCAL_CIDS`. And the old one, `IOCTL_VM_SOCKETS_GET_LOCAL_CID` is retained. For the transport that supports multi-devices: * `IOCTL_VM_SOCKETS_GET_LOCAL_CID` returns "-1"; * `IOCTL_VM_SOCKETS_GET_LOCAL_CIDS` returns a vector of CIDS. The usage is sh

Re: Re: [RFC PATCH 0/5] vsock/virtio: Add support for multi-devices

2024-05-29 Thread Xuewei Niu
Hi, MST! > > include/linux/virtio_vsock.h| 2 +- > > include/net/af_vsock.h | 25 ++- > > include/uapi/linux/virtio_vsock.h | 1 + > > include/uapi/linux/vm_sockets.h | 14 ++ > > net/vmw_vsock/af_vsock.c| 116 +-- > > net/v

Re: [PATCH 0/3] vsock: Introduce SIOCINQ ioctl support

2025-05-20 Thread Xuewei Niu
> On Mon, May 19, 2025 at 03:06:46PM +0800, Xuewei Niu wrote: > >This patchset introduces SIOCINQ ioctl support for vsock, indicating the > >number of unread bytes. > > Thanks for this work, but please use net-next tree since this is a new > feature: > https://www

Re: [PATCH 3/3] test/vsock: Add ioctl SIOCINQ tests

2025-05-20 Thread Xuewei Niu
> On Mon, May 19, 2025 at 03:06:49PM +0800, Xuewei Niu wrote: > >This patch adds two tests for ioctl SIOCINQ for SOCK_STREAM and > >SOCK_SEQPACKET. The client waits for the server to send data, and checks if > >the return value of the SIOCINQ is the size of the data. Then, con

Re: [PATCH 2/3] vsock/virtio: Add SIOCINQ support for all virtio based transports

2025-05-20 Thread Xuewei Niu
> On Mon, May 19, 2025 at 03:06:48PM +0800, Xuewei Niu wrote: > >The virtio_vsock_sock has a new field called bytes_unread as the return > >value of the SIOCINQ ioctl. > > > >Though the rx_bytes exists, we introduce a bytes_unread field to the > >virtio_vsock_s

[PATCH 2/3] vsock/virtio: Add SIOCINQ support for all virtio based transports

2025-05-19 Thread Xuewei Niu
inconsistency. The byte_unread is increased by the length of the skbuff when skbuff is enqueued, and it is decreased when dequeued. Signed-off-by: Xuewei Niu --- drivers/vhost/vsock.c | 1 + include/linux/virtio_vsock.h| 2 ++ net/vmw_vsock/virtio_transport.c| 1

[PATCH 3/3] test/vsock: Add ioctl SIOCINQ tests

2025-05-19 Thread Xuewei Niu
This patch adds two tests for ioctl SIOCINQ for SOCK_STREAM and SOCK_SEQPACKET. The client waits for the server to send data, and checks if the return value of the SIOCINQ is the size of the data. Then, consumes the data and checks if the value is 0. Signed-off-by: Xuewei Niu --- tools/testing

[PATCH 1/3] vsock: Add support for SIOCINQ ioctl

2025-05-19 Thread Xuewei Niu
This patch adds support for SIOCINQ ioctl, which returns the number of bytes unread in the socket. Signed-off-by: Xuewei Niu --- include/net/af_vsock.h | 2 ++ net/vmw_vsock/af_vsock.c | 22 ++ 2 files changed, 24 insertions(+) diff --git a/include/net/af_vsock.h b

[PATCH 0/3] vsock: Introduce SIOCINQ ioctl support

2025-05-19 Thread Xuewei Niu
implements the SIOCINQ ioctl for all virtio-based transports. The last one adds two test cases to check the functionality. The changes have been tested, and the results are as expected. Signed-off-by: Xuewei Niu Xuewei Niu (3): vsock: Add support for SIOCINQ ioctl vsock/virtio: Add SIOCINQ

Re: [PATCH 2/3] vsock/virtio: Add SIOCINQ support for all virtio based transports

2025-05-21 Thread Xuewei Niu
> On Wed, May 21, 2025 at 10:06:13AM +0800, Xuewei Niu wrote: > >> On Mon, May 19, 2025 at 03:06:48PM +0800, Xuewei Niu wrote: > >> >The virtio_vsock_sock has a new field called bytes_unread as the return > >> >value of the SIOCINQ ioctl. > >> >

Re: [PATCH 2/3] vsock/virtio: Add SIOCINQ support for all virtio based transports

2025-05-21 Thread Xuewei Niu
> On Wed, 21 May 2025 at 10:58, Stefano Garzarella wrote: > > > > Forgot to CC Arseniy. > > > > On Wed, 21 May 2025 at 10:57, Stefano Garzarella > > wrote: > > > > > > On Wed, May 21, 2025 at 10:06:13AM +0800, Xuewei Niu wrote: > > > &

Re: [PATCH net] vsock/virtio: fix `rx_bytes` accounting for stream sockets

2025-06-11 Thread Xuewei Niu
No comments since last month. The patch [1], which adds SIOCINQ ioctl support for vsock, depends on this patch. Could I get more eyes on this one? [1]: https://lore.kernel.org/lkml/bbn4lvdwh42m2zvi3rdyws66y5ulew32rchtz3kxirqlllkr63@7toa4tcepax3/#t Thanks, Xuewei

Re: [PATCH net] vsock/virtio: fix `rx_bytes` accounting for stream sockets

2025-06-12 Thread Xuewei Niu
> On Thu, 12 Jun 2025 at 10:21, Xuewei Niu wrote: > > > > > On Thu, 12 Jun 2025 at 08:50, Xuewei Niu wrote: > > > > > > > > > On Thu, Jun 12, 2025 at 01:32:01PM +0800, Xuewei Niu wrote: > > > > > > No comments since last month.

Re: [PATCH net] vsock/virtio: fix `rx_bytes` accounting for stream sockets

2025-06-11 Thread Xuewei Niu
> On Thu, Jun 12, 2025 at 01:32:01PM +0800, Xuewei Niu wrote: > > No comments since last month. > > > > The patch [1], which adds SIOCINQ ioctl support for vsock, depends on this > > patch. Could I get more eyes on this one? > > > >

Re: [PATCH net] vsock/virtio: fix `rx_bytes` accounting for stream sockets

2025-06-12 Thread Xuewei Niu
> On Thu, 12 Jun 2025 at 08:50, Xuewei Niu wrote: > > > > > On Thu, Jun 12, 2025 at 01:32:01PM +0800, Xuewei Niu wrote: > > > > No comments since last month. > > > > > > > > The patch [1], which adds SIOCINQ ioctl support for vsock, depends on

[PATCH net-next v2 3/3] test/vsock: Add ioctl SIOCINQ tests

2025-06-12 Thread Xuewei Niu
This patch adds SIOCINQ ioctl tests for both SOCK_STREAM and SOCK_SEQPACKET. The client waits for the server to send data, and checks if the SIOCINQ ioctl value matches the data size. After consuming the data, the client checks if the SIOCINQ value is 0. Signed-off-by: Xuewei Niu --- tools

[PATCH net-next v2 2/3] vsock/virtio: Add SIOCINQ support for all virtio based transports

2025-06-12 Thread Xuewei Niu
The value of the SIOCINQ is obtained by `virtio_transport_unread_bytes()`, which is generic for all virtio transports. The function acquires the `rx_lock` and returns the value of `rx_bytes`. Signed-off-by: Xuewei Niu --- drivers/vhost/vsock.c | 1 + include/linux

[PATCH net-next v2 0/3] vsock: Introduce SIOCINQ ioctl support

2025-06-12 Thread Xuewei Niu
implements the SIOCINQ ioctl for all virtio-based transports. The last one adds two test cases to check the functionality. The changes have been tested, and the results are as expected. Signed-off-by: Xuewei Niu -- v1->v2: https://lore.kernel.org/lkml/20250519070649.3063874-1-niuxue

[PATCH net-next v2 1/3] vsock: Add support for SIOCINQ ioctl

2025-06-12 Thread Xuewei Niu
This patch adds support for SIOCINQ ioctl, which returns the number of bytes unread in the socket. Signed-off-by: Xuewei Niu --- include/net/af_vsock.h | 2 ++ net/vmw_vsock/af_vsock.c | 22 ++ 2 files changed, 24 insertions(+) diff --git a/include/net/af_vsock.h b

Re: [PATCH net-next v3 2/3] test/vsock: Add retry mechanism to ioctl wrapper

2025-06-17 Thread Xuewei Niu
> On Tue, Jun 17, 2025 at 12:53:45PM +0800, Xuewei Niu wrote: > >Wrap the ioctl in `ioctl_int()`, which takes a pointer to the actual > >int value and an expected int value. The function will not return until > >either the ioctl returns the expected value or a timeout occ

[PATCH net-next v3 0/3] vsock: Introduce SIOCINQ ioctl support

2025-06-16 Thread Xuewei Niu
to prevent immediate failure. The last one adds two test cases to check the functionality. The changes have been tested, and the results are as expected. Signed-off-by: Xuewei Niu -- v1->v2: https://lore.kernel.org/lkml/20250519070649.3063874-1-niuxuewei@antgroup.com/ - Use net-next t

[PATCH net-next v3 1/3] vsock: Add support for SIOCINQ ioctl

2025-06-16 Thread Xuewei Niu
Add support for SIOCINQ ioctl, indicating the length of bytes unread in the socket. The value is obtained from `vsock_stream_has_data()`. Signed-off-by: Xuewei Niu --- net/vmw_vsock/af_vsock.c | 22 ++ 1 file changed, 22 insertions(+) diff --git a/net/vmw_vsock/af_vsock.c b

Re: [PATCH net-next v3 3/3] test/vsock: Add ioctl SIOCINQ tests

2025-06-17 Thread Xuewei Niu
> On Tue, Jun 17, 2025 at 12:53:46PM +0800, Xuewei Niu wrote: > >Add SIOCINQ ioctl tests for both SOCK_STREAM and SOCK_SEQPACKET. > > > >The client waits for the server to send data, and checks if the SIOCINQ > >ioctl value matches the data size. After consuming the da

Re: [PATCH net-next v2 3/3] test/vsock: Add ioctl SIOCINQ tests

2025-06-16 Thread Xuewei Niu
> On Fri, Jun 13, 2025 at 11:11:52AM +0800, Xuewei Niu wrote: > >This patch adds SIOCINQ ioctl tests for both SOCK_STREAM and > >SOCK_SEQPACKET. > > > >The client waits for the server to send data, and checks if the SIOCINQ > >ioctl value matches the data size. Aft

Re: [PATCH net-next v2 1/3] vsock: Add support for SIOCINQ ioctl

2025-06-16 Thread Xuewei Niu
> On Mon, Jun 16, 2025 at 03:42:53PM +0200, Luigi Leonardi wrote: > >On Fri, Jun 13, 2025 at 11:11:50AM +0800, Xuewei Niu wrote: > >>This patch adds support for SIOCINQ ioctl, which returns the number of > >>bytes unread in the socket. > >> > >>Signe

Re: [PATCH net-next v2 1/3] vsock: Add support for SIOCINQ ioctl

2025-06-16 Thread Xuewei Niu
> On Fri, Jun 13, 2025 at 11:11:50AM +0800, Xuewei Niu wrote: > >This patch adds support for SIOCINQ ioctl, which returns the number of > >bytes unread in the socket. > > > >Signed-off-by: Xuewei Niu > >--- > > include/net/af_vsock.h |

[PATCH net-next v3 3/3] test/vsock: Add ioctl SIOCINQ tests

2025-06-16 Thread Xuewei Niu
Add SIOCINQ ioctl tests for both SOCK_STREAM and SOCK_SEQPACKET. The client waits for the server to send data, and checks if the SIOCINQ ioctl value matches the data size. After consuming the data, the client checks if the SIOCINQ value is 0. Signed-off-by: Xuewei Niu --- tools/testing/vsock

[PATCH net-next v3 2/3] test/vsock: Add retry mechanism to ioctl wrapper

2025-06-16 Thread Xuewei Niu
Wrap the ioctl in `ioctl_int()`, which takes a pointer to the actual int value and an expected int value. The function will not return until either the ioctl returns the expected value or a timeout occurs, thus avoiding immediate failure. Signed-off-by: Xuewei Niu --- tools/testing/vsock/util.c