zhhyu7 opened a new pull request, #20219:
URL: https://github.com/apache/nuttx/pull/20219

   ## Summary
   Add vhost-net network device driver as the backend counterpart of 
virtio-net. The driver implements the netdev_lowerhalf interface and 
communicates with virtio-net through shared vring buffers. TX path copies 
netpkt data into vring buffers provided by the virtio side and defers netpkt 
release until the virtio side reclaims the buffer, keeping quota synchronized 
with actual vring availability. RX path copies data from vring buffers into 
locally allocated netpkts. Interrupt suppression follows the NAPI pattern -- 
callbacks are disabled during active polling and re-enabled only when no more 
buffers are available.
   
   ## Impact
   Adds a new vhost-net network device driver (CONFIG_DRIVERS_VHOST_NET) that 
serves as the backend counterpart to the existing virtio-net frontend driver.
   
   - **New feature / optional**: Gated entirely behind the new 
CONFIG_DRIVERS_VHOST_NET Kconfig option (default n). When disabled, there is no 
impact on existing builds or behavior.
   - **Affected area**: drivers/vhost only. Adds vhost-net.c / vhost-net.h and 
wires registration into vhost.c, CMakeLists.txt, and Make.defs. No existing 
source files' logic is changed beyond adding the 
   conditional registration hook.
   - **New dependencies auto-selected** when enabled: NETDEVICES, 
ARCH_HAVE_NETDEV_STATISTICS, NETDEV_LATEINIT, DRIVERS_VHOST, SCHED_WORKQUEUE.
   - **Functional behavior when enabled**:
     - Implements the netdev_lowerhalf interface and communicates with 
virtio-net over shared vring buffers.
     - **TX**: copies netpkt data into vring buffers supplied by the virtio 
side; defers netpkt release until the virtio side reclaims the buffer, keeping 
the TX quota synchronized with actual vring 
   availability.
     - **RX**: zero-copy — wraps the shared vring buffer in an IOB and returns 
it to the peer only after all IOBs in the chain are freed. RX quota does not 
consume pool IOBs.
     - Interrupt suppression follows the NAPI pattern: callbacks are disabled 
during active polling and re-enabled only when no more buffers are available.
     - Requires the VIRTIO_F_ANY_LAYOUT feature (asserted at init) so the 
virtio-net header and data can share one IO buffer.
     - MAC address is read from device config if VIRTIO_NET_F_MAC is present, 
otherwise a random locally-administered MAC is generated.
   - **API/ABI**: No change to public APIs. vhost_register_net_driver() is a 
new internal symbol compiled only when the option is enabled.
   - **Build**: No impact on default configs since the option is off by default.
   
   ## Testing
   To be supplemented.


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