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

   ## Summary
   
   There is no tool in nuttx-apps to exercise `AF_VSOCK` sockets. Add
   `examples/vsock`:
   
   ```
   vsock [-c <cid>] [-t data|conn] [-p <port>] [-i <size>] [-n <count>]
   ```
   
   - examples/vsock: add a vsock test client and server
     - `-t data`: the server echoes what it receives; the client (`-c`)
       sends `-n` buffers of `-i` bytes and checks the echo. Also builds
       on Linux against `<linux/vm_sockets.h>` to test against a Linux
       peer.
   - examples/vsock: add a connection stress test
     - `-t conn`: open and close `-n` connections in a row.
   - examples/vsock: accept a cid given as a name
     - The cids filled from cpu names in apache/nuttx#21818 hold the
       first four bytes of the name, so `-c prox` works as well as
       `-c 2020569712`.
   
   ## Impact
   
   New example, `CONFIG_EXAMPLES_VSOCK`, default n. No other change.
   
   ## Testing
   
   Host: Ubuntu 22.04.5 LTS x86_64, QEMU version 10.2.1, qemu-armv8a: 
aarch64-none-elf-gcc (Arm GNU Toolchain 12.2.Rel1 (Build arm-12.24)) 12.2.1 
20221205
   
   qemu-armv8a:rpserver + qemu-armv8a:rpproxy with apache/nuttx#21818
   (vsock over the rptun ivshmem resource table). Overlay on both:
   `CONFIG_NET`, `CONFIG_NET_SOCKOPTS`, `CONFIG_NET_VSOCK`,
   `CONFIG_EXAMPLES_VSOCK`; rpproxy adds `CONFIG_DRIVERS_VHOST` +
   `CONFIG_NET_VSOCK_VHOST`, rpserver adds `CONFIG_DRIVERS_VIRTIO` +
   `CONFIG_NET_VSOCK_VIRTIO`. Builds with 0 warnings.
   
   ```
   proxy>  vsock -t data -p 28065 -i 1024 -n 64 &
   server> vsock -c prox -t data -p 28065 -i 1024 -n 64
   proxy>  vsock -t conn -p 28066 &
   server> vsock -c 2020569712 -t conn -p 28066 -n 32
   ```
   
   <details><summary>output</summary>
   
   ```
   proxy> Vsock server test, port=28065, size=1024, cid=4294967295
   Vsock client test, port=28065, size=1024, count=64, cid=2020569712
   Connect, s=3
   Send finish, sendlen=65536
   Close
   server> Accept peer_fd=4
   Close
   proxy> Vsock client conn test: port=28066, cid=4294967295
   Vsock server conn test: port=28066, count=32, cid=2020569712
   Connection attempts: 32 (Success: 32, Failed: 0)
   ```
   </details>
   
   checkpatch passes.
   


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