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
Unknown Object (File)
Tue, Apr 16, 6:28 PM
Unknown Object (File)
Tue, Apr 16, 6:28 PM
Unknown Object (File)
Feb 13 2024, 9:22 AM
Unknown Object (File)
Jan 18 2024, 12:29 AM
Unknown Object (File)
Jan 18 2024, 12:26 AM
Unknown Object (File)
Jan 18 2024, 12:22 AM
Unknown Object (File)
Dec 23 2023, 12:40 AM
Unknown Object (File)
Dec 11 2023, 12:01 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
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 45492
Build 42380: arc lint + arc unit

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.