Page MenuHomeFreeBSD

Bhyve virtio-net: Allow backend type to be explicitly specified.
ClosedPublic

Authored by nyan_myuji.xyz on May 6 2022, 7:47 PM.
Tags
None
Referenced Files
F102836505: D35143.id107617.diff
Sun, Nov 17, 7:37 PM
F102834995: D35143.id106670.diff
Sun, Nov 17, 7:06 PM
F102832188: D35143.id105748.diff
Sun, Nov 17, 6:19 PM
Unknown Object (File)
Fri, Nov 15, 5:51 AM
Unknown Object (File)
Fri, Nov 15, 1:52 AM
Unknown Object (File)
Tue, Nov 12, 8:28 PM
Unknown Object (File)
Tue, Nov 12, 1:39 PM
Unknown Object (File)
Oct 8 2024, 9:05 AM

Details

Summary

Currently virtio-net is choosing the backend for virtio-net by the prefix of
the inteface. This patch allow an addition option "type" to choose backend type
explicitly. This allowed greater flexibility for end users to manage bhyve
specific resources (such as by naming the tap interfaces to more descriptive
names). The option "type" is optional. When it is not presented, the backend
will be derived by the name of the backend interface.

For example, the line -s 3,virtio-net,bsdvm0,type=tap will create a
virtio-net device for the guest using the tap interface "bsdvm0".

The idea behind adding the option "type" is to preserve the consistency
between the current (legacy) format. Which the next value after virtio-net
is set to be an identifier of an instance of a backend.

A drawback of this apporach is that; since tap interfaces cannot be created by
opening non "tap" prefixed device, if the backend tap interface is not presented
and such interface is not prefixed with "tap*", bhyve cannot automatically
create it. Since bhyve does not create the interfaces for other backends anyway,
it shouldn't be a big issue.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

  • change to use type as the option
  • yes I am an idiot and totally forgot bhyve-config(5)
nyan_myuji.xyz retitled this revision from Bhyve virtio-net: Allow backend to be explicitly specified. to Bhyve virtio-net: Allow backend type to be explicitly specified..May 6 2022, 8:23 PM
nyan_myuji.xyz edited the summary of this revision. (Show Details)
usr.sbin/bhyve/net_backends.c
993
type = get_config_value_node(nvl, "type");
if (type == NULL)
        type = devname;

is more straight IMO

  • change to use type as the option
  • simplify code
This revision is now accepted and ready to land.Jun 8 2022, 9:42 PM
jhb added a subscriber: jhb.
jhb added inline comments.
usr.sbin/bhyve/net_backends.c
993–996

If there are no objections, I would go ahead and commit this, incorporating the style fixes by @jhb

I've already started on this, but in order to set the author of the commit correctly I'd like to confirm the original submitter's name. I believe it is "Michael Chiu" based on a ports commit I found?

@jhb Thank you so much for helping! I have submitted a few patches under "Yan Ka Chiu" lately so I guess I will use that instead for consistency.

usr.sbin/bhyve/net_backends.c
993

good point, changed

While writing a followup manpage change to document this, it occurred to me that it would be simpler to explain if instead we added a new 'iface' keyword so that you could use 'backend=tap', and 'iface=bsdvm0'. I will work on a patch to convert to that instead I think as I it is more similar to what qemu does as well.