netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RESEND PATCH net-next v4 0/4] vsock: Introduce SIOCINQ ioctl support
@ 2025-06-30  7:57 Xuewei Niu
  2025-06-30  7:57 ` [RESEND PATCH net-next v4 1/4] vsock: Add support for SIOCINQ ioctl Xuewei Niu
                   ` (4 more replies)
  0 siblings, 5 replies; 17+ messages in thread
From: Xuewei Niu @ 2025-06-30  7:57 UTC (permalink / raw)
  To: sgarzare, mst, pabeni, jasowang, xuanzhuo, davem, netdev,
	stefanha, leonardi, decui
  Cc: virtualization, kvm, linux-kernel, fupan.lfp, Xuewei Niu

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


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2025-07-03  7:53 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-30  7:57 [RESEND PATCH net-next v4 0/4] vsock: Introduce SIOCINQ ioctl support Xuewei Niu
2025-06-30  7:57 ` [RESEND PATCH net-next v4 1/4] vsock: Add support for SIOCINQ ioctl Xuewei Niu
2025-07-02  9:56   ` Stefano Garzarella
2025-06-30  7:57 ` [RESEND PATCH net-next v4 2/4] hv_sock: Return the readable bytes in hvs_stream_has_data() Xuewei Niu
2025-07-02  9:58   ` Stefano Garzarella
2025-07-02 10:05     ` Xuewei Niu
2025-06-30  7:57 ` [RESEND PATCH net-next v4 3/4] test/vsock: Add retry mechanism to ioctl wrapper Xuewei Niu
2025-07-02 10:20   ` Stefano Garzarella
2025-07-03  3:05     ` Xuewei Niu
2025-07-03  7:36       ` Stefano Garzarella
2025-07-03  7:53         ` Xuewei Niu
2025-06-30  7:57 ` [RESEND PATCH net-next v4 4/4] test/vsock: Add ioctl SIOCINQ tests Xuewei Niu
2025-07-02 10:27   ` Stefano Garzarella
2025-07-03  2:51     ` Xuewei Niu
2025-07-03  7:37       ` Stefano Garzarella
2025-07-02  1:09 ` [RESEND PATCH net-next v4 0/4] vsock: Introduce SIOCINQ ioctl support Jakub Kicinski
2025-07-02  2:15   ` Xuewei Niu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).