mbox series

[net-next,v4,0/3] ioctl support for AF_VSOCK and virtio-based transports

Message ID 20240730-ioctl-v4-0-16d89286a8f0@outlook.com (mailing list archive)
Headers show
Series ioctl support for AF_VSOCK and virtio-based transports | expand

Message

Luigi Leonardi via B4 Relay July 30, 2024, 7:43 p.m. UTC
This patch series introduce the support for ioctl(s) in AF_VSOCK.
The only ioctl currently available is SIOCOUTQ, which returns
the number of unsent or unacked packets. It is available for
SOCK_STREAM, SOCK_SEQPACKET and SOCK_DGRAM.

As this information is transport-dependent, a new optional callback
is introduced: unsent_bytes.

The first patch add ioctl support in AF_VSOCK, while the second
patch introduce support for SOCK_STREAM and SOCK_SEQPACKET
in all virtio-based transports: virtio_transport (G2H),
vhost-vsock (H2G) and vsock-loopback.

The latest patch introduce two tests for this new feature.
More details can be found in each patch changelog.

v3->v4
- Fixed warnings produced by kernel test robots
- Functions are now *_unsent_bytes
- Minor style changes pointed out by Stefano
- Using opts->peer_port in tests
- Rebased to latest net-next
- Link to v3: https://lore.kernel.org/r/20240626-ioctl_next-v3-0-63be5bf19a40@outlook.com

v2->v3
Applied all reviewers' suggetions:
    - Minor style and code changes
    - atomic_int replaced with an existing spin_lock.
Introduced lock_sock on ioctl call.
Rebased to latest net-next

v1->v2
Applied all Stefano's suggestions:
    - vsock_do_ioctl has been rewritten
    - ioctl(SIOCOUTQ) test is skipped when it is not supported
    - Minor variable/function name changes
    - rebased to latest net-next

Signed-off-by: Luigi Leonardi <luigi.leonardi@outlook.com>
---
Luigi Leonardi (3):
      vsock: add support for SIOCOUTQ ioctl
      vsock/virtio: add SIOCOUTQ support for all virtio based transports
      test/vsock: add ioctl unsent bytes test

 drivers/vhost/vsock.c                   |  4 +-
 include/linux/virtio_vsock.h            |  6 +++
 include/net/af_vsock.h                  |  3 ++
 net/vmw_vsock/af_vsock.c                | 58 ++++++++++++++++++++--
 net/vmw_vsock/virtio_transport.c        |  4 +-
 net/vmw_vsock/virtio_transport_common.c | 35 ++++++++++++++
 net/vmw_vsock/vsock_loopback.c          |  6 +++
 tools/testing/vsock/util.c              |  6 +--
 tools/testing/vsock/util.h              |  3 ++
 tools/testing/vsock/vsock_test.c        | 85 +++++++++++++++++++++++++++++++++
 10 files changed, 202 insertions(+), 8 deletions(-)
---
base-commit: 1722389b0d863056d78287a120a1d6cadb8d4f7b
change-id: 20240730-ioctl-0da7dee1b725

Best regards,

Comments

Cong Wang Aug. 1, 2024, 4:35 p.m. UTC | #1
On Tue, Jul 30, 2024 at 09:43:05PM +0200, Luigi Leonardi via B4 Relay wrote:
> This patch series introduce the support for ioctl(s) in AF_VSOCK.
> The only ioctl currently available is SIOCOUTQ, which returns
> the number of unsent or unacked packets. It is available for
> SOCK_STREAM, SOCK_SEQPACKET and SOCK_DGRAM.
> 

Why not using sock diag to dump it? Like ->idiag_wqueue for TCP.

Thanks.
patchwork-bot+netdevbpf@kernel.org Aug. 2, 2024, 8:30 a.m. UTC | #2
Hello:

This series was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:

On Tue, 30 Jul 2024 21:43:05 +0200 you wrote:
> This patch series introduce the support for ioctl(s) in AF_VSOCK.
> The only ioctl currently available is SIOCOUTQ, which returns
> the number of unsent or unacked packets. It is available for
> SOCK_STREAM, SOCK_SEQPACKET and SOCK_DGRAM.
> 
> As this information is transport-dependent, a new optional callback
> is introduced: unsent_bytes.
> 
> [...]

Here is the summary with links:
  - [net-next,v4,1/3] vsock: add support for SIOCOUTQ ioctl
    https://git.kernel.org/netdev/net-next/c/744500d81f81
  - [net-next,v4,2/3] vsock/virtio: add SIOCOUTQ support for all virtio based transports
    https://git.kernel.org/netdev/net-next/c/e6ab45005772
  - [net-next,v4,3/3] test/vsock: add ioctl unsent bytes test
    https://git.kernel.org/netdev/net-next/c/18ee44ce97c1

You are awesome, thank you!