CV-Bowen opened a new pull request, #21790:
URL: https://github.com/apache/nuttx/pull/21790

   ## Summary
   
   `CONFIG_NET_VSOCK_VIRTIO` and `CONFIG_NET_VSOCK_VHOST`, added in #21627,
   do not build on master. This series makes both transports build and
   run.
   
   - drivers/virtio: add virtio_get_buffers()
     A vsock packet comes back as a chain of descriptors (header plus
     payload), and `vsock_virtio.c` calls `virtio_get_buffers()` to get all
     of them from one used ring entry; the function did not exist. Add it,
     and `virtio_get_next_buffer()`, a thin wrapper around open-amp's
     `virtqueue_get_next_avail_buffer()` that also accepts a NULL
     `next_idx`.
   - include/nuttx/virtio: add host_cid to the vsock config
     Both transports read the peer CID from the device config when
     `VIRTIO_VSOCK_F_HOST_CID` is offered; the header had neither.
   - net/vsock: include nuttx/fs/uio.h
     `vsock_sockif.c` uses `struct uio` and `uio_*()`, which
     `<nuttx/fs/fs.h>` no longer pulls in.
   - net/vsock: drop the node initializer from the driver structs
     `struct virtio_driver` and `struct vhost_driver` start with the device
     id and keep the list node last; the leftover `LIST_INITIAL_VALUE(node)`
     put every positional field one off.
   
   ## Impact
   
   - Two new functions in `include/nuttx/virtio/virtio.h`.
   - `struct virtio_vsock_config_s` gains `host_cid` (u64) after
     `guest_cid`, as in the VirtIO 1.3 vsock device config.
   - The vsock virtio and vhost transports now build. No Kconfig change, no
     behaviour change elsewhere.
   
   ## Testing
   
   Host: Ubuntu 22.04.5 LTS x86_64, QEMU version 10.2.1, sim: cc (Ubuntu 
13.1.0-8ubuntu1~22.04) 13.1.0, qemu-armv8a: aarch64-none-elf-gcc (Arm GNU 
Toolchain 12.2.Rel1 (Build arm-12.24)) 12.2.1 20221205
   
   qemu-armv8a:netnsh with `CONFIG_NET_VSOCK=y`, `CONFIG_NET_VSOCK_VIRTIO=y`,
   `CONFIG_DRIVERS_VHOST=y`, `CONFIG_NET_VSOCK_VHOST=y`,
   `CONFIG_NET_VSOCK_LOCAL=y`: master does not build, this PR builds with 0
   warnings.
   
   Runtime, qemu-armv8a:netnsh with the virtio transport and a vsock echo
   client in the guest, against a host `AF_VSOCK` echo server:
   
   ```
   qemu-system-aarch64 -cpu cortex-a53 -nographic \
     -machine virt,virtualization=on,gic-version=3 -serial mon:stdio \
     -global virtio-mmio.force-legacy=false \
     -device vhost-vsock-device,guest-cid=<cid>,bus=virtio-mmio-bus.0 \
     -kernel nuttx
   ```
   
   64 x 1 KiB echoed, 65536 bytes each way:
   
   <details><summary>guest and host</summary>
   
   ```
   nsh> vsock -c 2 -t data -p 28065 -i 1024 -n 64
   Vsock client test, port=28065, size=1024, count=64, cid=2
   Connect, s=3
   Send
   Send finish, sendlen=65536
   Close
   nsh> echo rc=$?
   ```
   
   ```
   host accepted (180, 1024)
   host echoed 65536
   ```
   </details>
   
   No regression in rpmsg: sim:rpserver/rpproxy and 
qemu-armv8a:rpserver/rpproxy boot and pass the fixed rpmsg cases (dump, ping, 
rpmsgfs; 15/15). No regression in virtio: qemu-armv8a:netnsh boot and pass the 
fixed virtio cases (rng, blk on mmio and pci, net, 9p; 24/24). qemu-armv8a was 
built with LIBC_ENVPATH and BINFMT_CHECKEXEC disabled, which current master 
needs for nxinit to start nsh there; unrelated to this change.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to