[RESEND PATCH net-next v4 0/4] vsock: Introduce SIOCINQ ioctl support

Xuewei Niu posted 4 patches 3 months, 1 week ago
There is a newer version of this series
net/vmw_vsock/af_vsock.c         | 22 +++++++++
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 ++++++++++++++++++++++++++++++++
5 files changed, 139 insertions(+), 12 deletions(-)
[RESEND PATCH net-next v4 0/4] vsock: Introduce SIOCINQ ioctl support
Posted by Xuewei Niu 3 months, 1 week ago
Introduce SIOCINQ ioctl support for vsock, indicating the length of unread
bytes.

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 <niuxuewei.nxw@antgroup.com>

--

v1->v2:
https://lore.kernel.org/lkml/20250519070649.3063874-1-niuxuewei.nxw@antgroup.com/
- 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/
- 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/
- 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 (4):
  vsock: Add support for SIOCINQ ioctl
  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/af_vsock.c         | 22 +++++++++
 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 ++++++++++++++++++++++++++++++++
 5 files changed, 139 insertions(+), 12 deletions(-)

-- 
2.34.1
Re: [RESEND PATCH net-next v4 0/4] vsock: Introduce SIOCINQ ioctl support
Posted by Jakub Kicinski 3 months, 1 week ago
On Mon, 30 Jun 2025 15:57:23 +0800 Xuewei Niu wrote:
> Introduce SIOCINQ ioctl support for vsock, indicating the length of unread
> bytes.
> 
> Similar with SIOCOUTQ ioctl, the information is transport-dependent.

This series does not apply cleanly on current net-next.
Please rebase & repost.
Please note that we request that repost do not happen more often than
24 hours apart:
https://www.kernel.org/doc/html/next/process/maintainer-netdev.html
-- 
pw-bot: cr
Re: [RESEND PATCH net-next v4 0/4] vsock: Introduce SIOCINQ ioctl support
Posted by Xuewei Niu 3 months, 1 week ago
> On Jul 2, 2025, at 09:09, Jakub Kicinski <kuba@kernel.org> wrote:
> 
> On Mon, 30 Jun 2025 15:57:23 +0800 Xuewei Niu wrote:
>> Introduce SIOCINQ ioctl support for vsock, indicating the length of unread
>> bytes.
>> 
>> Similar with SIOCOUTQ ioctl, the information is transport-dependent.
> 
> This series does not apply cleanly on current net-next.
> Please rebase & repost.
> Please note that we request that repost do not happen more often than
> 24 hours apart:
> https://www.kernel.org/doc/html/next/process/maintainer-netdev.html

I'll rebase, and send out v5 in a few days, in order to have more comments.

Thanks,
Xuewei

> -- 
> pw-bot: cr