HomeFreeBSD

bhyve: Use a non-blocking read in slirp_recv()

Description

bhyve: Use a non-blocking read in slirp_recv()

When using the slirp backend with the e1000 frontend, I otherwise get
hangs in readv(), caused by the e1000 emulation not checking whether
bytes are available before trying to read them. In particular, that
device model expects the recv callback to return 0 if no bytes are
available, and with slirp it would end up blocking forever. The virtio
device model uses the peek_recvlen to check first, so I didn't notice
the problem when implementing the slirp backend.

Make the slirp backend more flexible to accommodate e1000.

MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D48164

(cherry picked from commit d3bdfa583044dbfb76ef777939b86bb68baebee7)

Details

Provenance
markjAuthored on Jan 7 2025, 2:33 PM
Differential Revision
D48164: bhyve: Use a non-blocking read in slirp_recv()
Parents
rG028323d61649: setfib.2: Note that the number of FIBs can be adjusted after boot
Branches
Unknown
Tags
Unknown