Thread (7 messages) 7 messages, 2 authors, 2025-06-30

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

From: Stefano Garzarella <sgarzare@redhat.com>
Date: 2025-06-30 07:58:29
Also in: kvm, lkml, virtualization

On Mon, 30 Jun 2025 at 09:54, Xuewei Niu [off-list ref] wrote:
quoted
On Mon, Jun 30, 2025 at 03:38:24PM +0800, Xuewei Niu wrote:
quoted
Introduce SIOCINQ ioctl support for vsock, indicating the length of unread
bytes.
I think something went wrong with this version of the series, because I
don't see the patch introducing support for SIOCINQ ioctl in af_vsock.c,
or did I miss something?
Oh yes. Since adding a patch for hyper-v, I forgot to update the `git
format-patch` command...
I'd suggest using some tools like b4 or git-publish for the future:
- https://b4.docs.kernel.org/en/latest/contributor/overview.html
- https://github.com/stefanha/git-publish
Please ignore this patchset and I'll resend a new one.
Please send a v5, so it's clear this version is outdated.

Thanks,
Stefano
Thanks,
Xuewei
quoted
quoted
Similar with SIOCOUTQ ioctl, the information is transport-dependent.

The first patch adds SIOCINQ ioctl support in AF_VSOCK.

Thanks to @dexuan, the second patch is to fix the issue where hyper-v
`hvs_stream_has_data()` doesn't return the readable bytes.

The third patch wraps the ioctl into `ioctl_int()`, which implements a
retry mechanism 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 <redacted>

--

v1->v2:
https://lore.kernel.org/lkml/20250519070649.3063874-1-niuxuewei.nxw@antgroup.com/ (local)
- Use net-next tree.
- Reuse `rx_bytes` to count unread bytes.
- Wrap ioctl syscall with an int pointer argument to implement a retry
 mechanism.

v2->v3:
https://lore.kernel.org/netdev/20250613031152.1076725-1-niuxuewei.nxw@antgroup.com/ (local)
- Update commit messages following the guidelines
- Remove `unread_bytes` callback and reuse `vsock_stream_has_data()`
- Move the tests to the end of array
- Split the refactoring patch
- Include <sys/ioctl.h> in the util.c

v3->v4:
https://lore.kernel.org/netdev/20250617045347.1233128-1-niuxuewei.nxw@antgroup.com/ (local)
- Hyper-v `hvs_stream_has_data()` returns the readable bytes
- Skip testing the null value for `actual` (int pointer)
- Rename `ioctl_int()` to `vsock_ioctl_int()`
- Fix a typo and a format issue in comments
- Remove the `RECEIVED` barrier.
- The return type of `vsock_ioctl_int()` has been changed to bool

Xuewei Niu (3):
 hv_sock: Return the readable bytes in hvs_stream_has_data()
 test/vsock: Add retry mechanism to ioctl wrapper
 test/vsock: Add ioctl SIOCINQ tests

net/vmw_vsock/hyperv_transport.c | 16 +++++--
tools/testing/vsock/util.c       | 32 +++++++++----
tools/testing/vsock/util.h       |  1 +
tools/testing/vsock/vsock_test.c | 80 ++++++++++++++++++++++++++++++++
4 files changed, 117 insertions(+), 12 deletions(-)

--
2.34.1
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help