-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This patch provides preliminary support for virtio-net, enabling inter-guest communication with the correct settings. To enable virtio support, we have made vwifi capable of recognizing virtio-net devices by registering vwifi with the virtio driver and providing the necessary probe/remove functions. Regarding virtqueues (referred to as vq), we currently have one RX vq and one TX vq (multi-queue support is not yet available): - TX vq: Whenever a frame needs to be sent, we add an output buffer to the TX vq and call virtqueue_kick() to transmit the data to the virtio-net device. - RX vq: Upon ndo_open(), we populate an input buffer into the RX vq and replenish the input buffer with each RX interrupt. It is important to note that when putting/getting buffers or kicking buffers, we must hold the virtio spinlock to ensure that no other operations occur on the vq simultaneously. Additionally, while acquiring the spinlock, we should avoid calling dev_kfree_skb() (as it is not safe in interrupt context) and restrict ourselves to using kmalloc() with GFP_ATOMIC. We use spin_lock_irqsave() because the TX/RX completion interrupt might be reentrant and could potentially lead to deadlocks. As of now, vwifi does not support most of the virtio-net features. To provide future support, our focus should initially be on implementing multi-queue support and incorporating NAPI on the RX path. In the context of vwifi management frames, originally, vwifi performed management operations, such as cfg80211_ops->scan(), and handled the TX/RX path using a 'shortcut' method. This entailed acquiring the network interface structures and struct owl_vif by iterating through the vif list and locating the one with the same MAC address. This approach was feasible only when all interfaces resided on the same host. To address the challenge of dealing with vwifi spread across multiple machines, we have introduced the concept of "vwifi management frames." Many of these management frame types draw inspiration from IEEE 802.11 management frames, with minor adjustments made due to the fact that we are dealing with Ethernet frames. It is important to note that we transmit these management frames with the Ethertype/length field set as "length" (i.e., 802.3 frames). This allows us to distinguish them from data frames (Ethernet II). Additionally, it is crucial to ensure that multi-octet fields follow a specific byte order so that data is consistently interpreted across different machines. We employ a little-endian byte order, making it possible for most machines to directly read the data. Multi-octet fields should be of the __leX type, and the sender is responsible for calling cpu_to_leX() on the data to be transmitted. This enables the receiver to utilize leX_to_cpu() to access and store the data in its machine's byte order. For a more comprehensive description of all management frame types (including how an STA handles frames from other BSS), please refer to the comments in vwifi.c, located above the definition of enum VWIFI_VIRTIO_PACKET_TYPE. Signed-off-by: EN-WEI WU <[email protected]>
- Loading branch information
1 parent
ad2cb66
commit 038b13d
Showing
6 changed files
with
1,523 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,11 @@ | ||
interface=owl0 | ||
driver=nl80211 | ||
ssid=TestAP | ||
debug=1 | ||
ctrl_interface=/var/run/hostapd | ||
ctrl_interface_group=wheel | ||
channel=6 | ||
ssid=test | ||
wpa=2 | ||
wpa_passphrase=12345678 | ||
wpa_key_mgmt=WPA-PSK | ||
wpa_pairwise=CCMP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
network={ | ||
ssid="test" | ||
psk="12345678" | ||
} |
Oops, something went wrong.