gemstonedevteam opened a new pull request, #20218:
URL: https://github.com/apache/nuttx/pull/20218
Four commits: `vhost_get_vq_buffers_pa()`, the vhost-net driver, the board
`netnsh` configuration, and documentation.
### Summary
* Implements the **device** end of virtio-net, so a peer processor running
the
stock virtio-net **driver** (e.g. Linux via remoteproc/rproc-virtio) sees
this side as a network card. Registers a netdev lowerhalf (`ethN`).
* Ring layout follows the peer driver's numbering: `vq[0]` is the peer RX
queue (the peer posts empty buffers; we fill them to transmit), `vq[1]`
is
the peer TX queue (we harvest posted frames as our receive path). No
virtio-net features are negotiated, so every frame carries the legacy
10-byte `virtio_net_hdr`, zeroed.
* `vhost_get_vq_buffers()` converts descriptor addresses to CPU pointers
through the shared-memory I/O region, which silently truncates when the
CPU
cannot address all of the peer's memory — a 32-bit remote core against a
64-bit host, where `metal_phys_addr_t` is 32-bit and Linux posts buffers
above 4 GB. `vhost_get_vq_buffers_pa()` returns the raw 64-bit descriptor
address and length so class drivers can translate through whatever window
hardware the platform provides.
* Also gives `DRIVERS_VHOST` a Kconfig prompt: it was promptless and
therefore
not selectable without a driver forcing it. `DRIVERS_VHOST_NET` selects
it.
* Adds a `netnsh` board configuration so CI has an in-tree configuration
that
actually compiles the driver.
### Impact
* Is new feature added? **YES** — a device-role virtio-net driver, plus a
new
board configuration.
* Impact on user? **NO** — new driver, opt-in by Kconfig.
* Impact on build? **NO** — `DRIVERS_VHOST` gaining a prompt only makes an
existing symbol selectable; its default is unchanged.
* Impact on hardware? **YES** — `drivers/vhost` (generic), arch/arm/am67
(RAT
translation hook), board t3-gem-o1.
* Impact on documentation? **YES** — provided in this PR.
* Impact on security? **NO**.
* Impact on compatibility? **NO** — `vhost_get_vq_buffers()` is unchanged;
the
`_pa` variant is additive.
* Anything else? Per rule 1.7.9, `vhost_get_vq_buffers_pa()` and the driver
are bundled deliberately: the driver cannot address peer buffers without
it
and the accessor has no other caller. This is not a breaking change.
* Note for reviewers reproducing the runtime test: the Linux side of a
non-coherent link needs DMA-sync cache maintenance on payloads. The
legacy
rproc vdev cannot negotiate `VIRTIO_F_ACCESS_PLATFORM` (32-bit
resource-table feature field), so its vring layer will not do this by
itself. Reproducing also needs `virtio_net.ko` on the peer, which is not
present in the stock t3-gem-o1 rootfs.
### Testing
```
Build Host(s): Pardus GNU/Linux 25 (Debian 13 base), x86_64, host gcc 14
Toolchain: arm-none-eabi-gcc 14.2.1 20241119 (15:14.2.rel1-1)
Target: arm / TI AM67 (J722S) Cortex-R5F, board t3-gem-o1:netnsh
nuttx-apps: 5a7ab4200
Loaded on the main-domain R5F by Linux remoteproc; console on UART-MAIN1.
```
Testing logs before change: no networking on this arch.
The version string in the logs is from the tested build; the commits were
GPG-signed afterwards, which rewrites hashes. The code is unchanged.
Testing logs after change:
```
make distclean && ./tools/configure.sh t3-gem-o1:netnsh && make -j
-> nuttx ELF 643252 bytes, 0 compiler warnings
Console:
nsh> ifconfig
eth0 Link encap:Ethernet HWaddr 02:54:33:00:00:01 at RUNNING mtu 576
inet addr:10.0.0.2 DRaddr:10.0.0.1 Mask:255.255.255.0
nsh> ifconfig eth0 192.168.10.2
nsh> ifup eth0
ifup eth0...OK
nsh> ifconfig
eth0 Link encap:Ethernet HWaddr 02:54:33:00:00:01 at RUNNING mtu 576
inet addr:192.168.10.2 DRaddr:192.168.10.1 Mask:255.255.255.0
Test plan result:
console_alive PASS prompt responsive
version PASS NuttX version 0.0.0 cd1c51e4af Sep 10 2026
13:50:14 t3-gem-o1:netnsh
procfs PASS procfs readable
tasks PASS 4 task lines
net_iface PASS eth0 present
net_ifup PASS eth0 192.168.10.2 RUNNING
net_ping_linux_to_nuttx PASS 5/5 via eth1, avg 0.269 ms
net_flood PASS 60 packets, 0% loss
rptun_node PASS /dev/rptun: r5f
linux_remoteproc PASS remoteproc3 running, fw=j722s-main-r5f0_0-fw,
vdevs=virtio1,virtio2
linux_rpmsg_channels PASS 2 channel(s): virtio1.rpmsg_ctrl.0.0
virtio1.rpmsg_ns.53.53
PASS=11
```
### PR verification Self-Check
* [x] This PR introduces only one functional change.
* [x] I have updated all required description fields above.
* [x] My PR adheres to Contributing Guidelines and Documentation.
* [ ] My PR is still work in progress (not ready for review).
* [x] My PR is ready for review and can be safely merged into a codebase.
--
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]