Skip to content

nshlib: add a ping subcommand to the virtio and vhost commands - #4112

Merged
xiaoxiang781216 merged 1 commit into
apache:masterfrom
CV-Bowen:up/P127-virtio-ping
Nov 25, 2026
Merged

xiaoxiang781216 merged 1 commit into
apache:masterfrom
CV-Bowen:up/P127-virtio-ping

Conversation

@CV-Bowen

@CV-Bowen CV-Bowen commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add a ping subcommand to the nsh virtio and vhost commands:

virtio ping <name> <times> <len> <period(ms)>
vhost ping <name> <times> <len> <period(ms)>

It fills a struct virtio_ping_s and issues VIRTIOIOC_PING on
/dev/virtio (or VHOSTIOC_PING on /dev/vhost); the kernel prints the
result to syslog. <name> is the ping instance name shown by
virtio dump / vhost dump, or all. The maximum argument count of both
commands goes from 3 to 6 so the extra arguments reach the handler.

Depends on apache/nuttx#22167 (merged; the virtio ping device and VIRTIOIOC_PING) and apache/nuttx#22236 (the vhost side and VHOSTIOC_PING).

Impact

nsh virtio / vhost only. dump behaves as before; the help text
gains the ping usage.

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

Built and used together with apache/nuttx#22167 and apache/nuttx#22236 on
qemu-armv8a:rpserver + qemu-armv8a:rpproxy (rptun over ivshmem, with a
test-only ping vdev in the resource table) and on sim:rpserver +
sim:rpproxy. See that PR for the measurements.

server> virtio ping all 100 64 0
[server] ping device: ping0
[server] ping times: 100, send_len: 64
[server] avg: 0 s, 113525 ns
[server] min: 0 s, 86704 ns
[server] max: 0 s, 1554287 ns
[server] rate: 5.426117 Mbits/sec
server> virtio ping nosuch 10 64 0
nsh: virtio: ioctl failed: 19

virtio dump all / vhost dump all unchanged (baseline cases below).

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.

Add "virtio ping <name> <times> <len> <period(ms)>" (and the same for
vhost), which runs a ping measurement through VIRTIOIOC_PING on
/dev/virtio, or VHOSTIOC_PING on /dev/vhost, and leaves the result in
syslog. Raise the maximum argument count of both commands to 6, so the
framework passes the extra arguments to the handler.

Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
@CV-Bowen
CV-Bowen force-pushed the up/P127-virtio-ping branch from 563dd50 to cc63376 Compare November 24, 2026 13:04
@xiaoxiang781216
xiaoxiang781216 merged commit 7701b49 into apache:master Nov 25, 2026
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants