Page MenuHomeFreeBSD

bhyve: change vq_getchain to return iovecs in both directions

Authored by khng on Mar 26 2021, 5:25 PM.
Referenced Files
Unknown Object (File)
Tue, Feb 28, 5:12 PM
Unknown Object (File)
Feb 17 2023, 9:17 PM
Unknown Object (File)
Feb 15 2023, 6:37 AM
Unknown Object (File)
Feb 12 2023, 5:30 PM
Unknown Object (File)
Feb 2 2023, 7:47 AM
Unknown Object (File)
Dec 18 2022, 7:22 AM
Unknown Object (File)
Dec 13 2022, 2:25 PM



bhyve: change vq_getchain to return read and write iovecs

The old prototype requires callers to inspect flags of each descriptors
to get the starting position of host-to-guest iovecs.

vq_getchain() is changed to return a virtio request with both the
guest-to-host iovecs and host-to-guest iovecs recorded instead.
Callers can obtain the host-to-guest iovecs directly.

Sponsored by: The FreeBSD Foundation
MFC after: 3 weeks

Diff Detail

rS FreeBSD src repository - subversion
Lint Passed
No Test Coverage
Build Status
Buildable 38090
Build 34979: arc lint + arc unit

Event Timeline

khng requested review of this revision.Mar 26 2021, 5:25 PM
  • Fixed loopy check fallout out when num of descs are equal to maximum number
  • No need to use memset in vq_getchain
afedorov added inline comments.

It looks like the flags[] array is no longer used.


Debug output doesn't make sense anymore.

  • Remove unused flags from pci_vt9p_notify
khng marked 2 inline comments as done.Mar 27 2021, 8:33 AM
afedorov added inline comments.

enqueuedvi -> enqueued

This revision is now accepted and ready to land.Mar 28 2021, 8:59 AM
khng retitled this revision from bhyve: vq_getchain returns read iovecs and write iovecs to bhyve: change vq_getchain to return iovecs in both directions.Mar 29 2021, 5:57 PM
khng marked an inline comment as done.

Refactor the prototype to match vq_ring_enqueue_segments in sys/dev/virtio/virtqueue.c.

This revision now requires review to proceed.Mar 29 2021, 5:59 PM

@afedorov I would like to have some comments on this again.


The previous comment inside the loop (deleted lines 348-354 in this diff) was a little clearer. I agree that the assertion should be outside the loop but the comment could be a little clearer. To a casual reader, the assertion is inverted.


It would look very slightly neater to initialise this further down, rather than where it's declared. None of the other stack variables are initialised at the top of this function.


E.g. initialise req = { 0 }; here.

Great! Thank you.

Approved by: philip (mentor)

This revision is now accepted and ready to land.Mar 30 2021, 2:48 AM
afedorov added inline comments.

“vs” argument is unused.

khng marked 2 inline comments as done.Mar 30 2021, 7:55 AM