linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v6 0/4] vsock: Introduce SIOCINQ ioctl support
@ 2025-07-08  6:36 Xuewei Niu
  2025-07-08  6:36 ` [PATCH net-next v6 1/4] hv_sock: Return the readable bytes in hvs_stream_has_data() Xuewei Niu
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Xuewei Niu @ 2025-07-08  6:36 UTC (permalink / raw)
  To: K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui,
	Stefano Garzarella, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Simon Horman
  Cc: linux-hyperv, virtualization, netdev, linux-kernel, Xuewei Niu,
	niuxuewei97

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

v4->v5:
https://lore.kernel.org/netdev/20250630075727.210462-1-niuxuewei.nxw@antgroup.com/
- Put the hyper-v fix before the SIOCINQ ioctl implementation.
- Remove my SOB from the hyper-v fix patch.
- Move the `need_refill` initialization into the `case 1` block.
- Remove the `actual` argument from `vsock_ioctl_int()`.
- Replace `TIOCINQ` with `SIOCINQ`.

v5->v6:
https://lore.kernel.org/netdev/20250706-siocinq-v5-0-8d0b96a87465@antgroup.com/
- Correct the author
- Fix a typo in hyper-v fix

---
Dexuan Cui (1):
      hv_sock: Return the readable bytes in hvs_stream_has_data()

Xuewei Niu (3):
      vsock: Add support for SIOCINQ ioctl
      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 | 17 +++++++--
 tools/testing/vsock/util.c       | 30 ++++++++++-----
 tools/testing/vsock/util.h       |  1 +
 tools/testing/vsock/vsock_test.c | 79 ++++++++++++++++++++++++++++++++++++++++
 5 files changed, 137 insertions(+), 12 deletions(-)
---
base-commit: 5f712c3877f99d5b5e4d011955c6467ae0e535a6
change-id: 20250703-siocinq-9e2907939806

Best regards,
-- 
Xuewei Niu <niuxuewei.nxw@antgroup.com>


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

end of thread, other threads:[~2025-07-10  2:49 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-08  6:36 [PATCH net-next v6 0/4] vsock: Introduce SIOCINQ ioctl support Xuewei Niu
2025-07-08  6:36 ` [PATCH net-next v6 1/4] hv_sock: Return the readable bytes in hvs_stream_has_data() Xuewei Niu
2025-07-08 10:49   ` Stefano Garzarella
2025-07-09 23:23   ` Wei Liu
2025-07-08  6:36 ` [PATCH net-next v6 2/4] vsock: Add support for SIOCINQ ioctl Xuewei Niu
2025-07-08 10:52   ` Stefano Garzarella
2025-07-09 15:00   ` Luigi Leonardi
2025-07-08  6:36 ` [PATCH net-next v6 3/4] test/vsock: Add retry mechanism to ioctl wrapper Xuewei Niu
2025-07-08 10:54   ` Stefano Garzarella
2025-07-09 15:02   ` Luigi Leonardi
2025-07-08  6:36 ` [PATCH net-next v6 4/4] test/vsock: Add ioctl SIOCINQ tests Xuewei Niu
2025-07-08 10:57   ` Stefano Garzarella
2025-07-09 15:05   ` Luigi Leonardi
2025-07-10  2:50 ` [PATCH net-next v6 0/4] vsock: Introduce SIOCINQ ioctl support patchwork-bot+netdevbpf

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).