sysprog21 / vwifi

A virtual wireless device driver for Linux
MIT License
203 stars 39 forks source link

Support virtio-net #45

Closed rickywu0421 closed 1 year ago

rickywu0421 commented 1 year ago

Supporting virtio on vwifi by pretending vwifi as a virtio-net driver. For now, we can do inter-guest communication by the correct setting described in README.md. We mainly enhance vwifi in two aspects:

For now, most of the virtio-net features are not supported by vwifi. For future support, we can firstly focus on the multi-queue feature and using NAPI on the RX path.

We introduce the "vwifi management frame" since it's not possible to get the other network interface structures or struct owl_vif when vwifi is across many machines.

Most of these management frame types are inspired by IEEE 802.11 management frames, with little modifications since we are sending Ethernet frames. And note that we send these management frames with the Ethertype/length field being length (i.e. 802.3 frames), so we can distinguish it from a data frame (Ethernet II).

Note that any multi-octet field should be in a specific byte-order so that any machine reads the same data as the writer's wish. For byte order, we use little-endian so that most of the machine can directly read the data. The multi-octet fields should be in __leX type, and the sender is responsible to call cpu_to_leX() on the data to be sent so that anytime the receiver can use leX_to_cpu() to access the data and store it in its machine byte-order.

For a more detailed description of all the management frame types (or how an STA will not receive the frames from other BSS), please check the comments in vwifi.c (above the definition of enum VWIFI_VIRTIO_PACKET_TYPE).