1. 11
  1.  

  2. 3

    I kind of like the wifibox solution, which doesn’t require any extra hardware, and will work with any device that Linux supports

    1. 4

      The caveat here is that you need a PCI-connected WiFi card. If the WiFi interface is driven off USB then (I think) bhyve can’t do passthrough without assigning the entire USB controller to the VM (which may mean you lose your keyboard and mouse as well).

      I believe there’s also been some work to get Linux WiFi drivers working via the LinuxKPI layer, though I’m not sure what the status is. Back in the distant past, I used Project Evil, which had an NDIS implementation that ran the Windows driver DLL as a network driver, but it wasn’t very stable.

      I haven’t looked at Android’s HAL in any detail. I believe one of the goals was to run WiFi (and cellular) drivers in userspace with a stable API so that they didn’t need updating across kernel revisions. It would be quite interesting if this could be ported to run on FreeBSD so that you could get support for any chipsets that have Android drivers.

      1. 1

        The caveat here is that you need a PCI-connected WiFi card. If the WiFi interface is driven off USB then (I think) bhyve can’t do passthrough without assigning the entire USB controller to the VM (which may mean you lose your keyboard and mouse as well).

        You can pass that USB controller into bhyve(8) … but that can also ‘take’ away your USB ports into Bhyve VM :)

        1. 2

          Yup, that’s the worry. On cheap laptops I’ve seen, the WiFi interface, built-in keyboard and trackpad are all on the same USB root, so if you assign WiFi to the VM then your keyboard stops working.

          VirtualBox supports USB pass through by emulating a USB controller and forwarding packets. It would probably be a few weeks of hacking to add something like this to bhyve. FreeBSD already has a generic USB interface that exposes a device directly to userspace.

          It would also be interesting to use LKL to run a Linux USB WiFi driver in a Capsicum sandboxed process and use tap / tun to route packets to and from it.

          1. 1

            Yeah.

            A lot depends on the hardware … like with the WiFi chip itself of course.

            Losing keyboard to get WiFi seems even more downgrade - that is why I added several ways to the article and not only the wifibox way :)

            To be honest I haven’t seen working USB passthru with VirtualBox on FreeBSD since ages - it just does not work for me - even in the slowish USB 1.1 open source way - but maybe its my settings or something else …

            Regards.

            1. 1

              To be honest I haven’t seen working USB passthru with VirtualBox on FreeBSD since ages - it just does not work for me - even in the slowish USB 1.1 open source way - but maybe its my settings or something else …

              I’ve only tried it on macOS and it didn’t work there either, but I assumed I was doing something wrong. USB 1.1 is as fast as 802.11b, so probably not a win. I’m really curious whether the LKL approach would work though.

              1. 1

                It seems to work for graphics stack so I assume it will work similarly well on the WiFi side … at least I hope so :)

    2. 3

      Perhaps worth noting that as part of my (sponsored by donations!) work on Haiku wherein I ported OpenBSD’s WiFi stack and some of their drivers (including iwm and iwx), which works at 802.11ac speeds, I created a headers-only* compatibility layer to map OpenBSD KPIs to FreeBSD ones, and also translate FreeBSD ioctls to/from OpenBSD ones.

      *Now, some of this was possible because I could add some “extensions” to our FreeBSD compatibility layer to support e.g. OpenBSD’s giant-lock semantics, but if someone really wanted to, they likely could manage to finagle this setup into working on real FreeBSD with some work. I have no idea if anyone would want to spend time on that, though. Maybe you could just come use Haiku instead :-)

      1. 2

        I know there’s an element of … whatever the opposite of sour grapes is? synthetic happiness? … here but I’ve run FreeBSD as a daily driver for years. In some cases I’ve dual-booted to Linux and the WiFi performance is notably better. But I’ve found the performance on FreeBSD perfect acceptable.

        On the rare occasions I really need high speed, I just go find a spare Ethernet port on the switch to plug into.

        Major caveat: nothing of what I do involve large files. No ML training sets, huge raw videos, etc.