Skip to content

Commit 971e0b1

Browse files
jakecorrentislp
authored andcommitted
docs: document new virtio-net arguments
Signed-off-by: Jake Correnti <[email protected]>
1 parent a9ed421 commit 971e0b1

File tree

1 file changed

+59
-3
lines changed

1 file changed

+59
-3
lines changed

docs/usage.md

Lines changed: 59 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,18 +85,52 @@ The `virtio-net` option adds a network interface to a virtual machine.
8585

8686
#### Arguments
8787

88+
Arguments to create a virtio-net device that has offloading enabled by default and will send a VFKIT magic
89+
value after establishing the connection:
8890
- `unixSocketPath`: Path to a UNIX socket to attach to the guest network interface.
8991
- `mac`: MAC address of a virtual machine.
9092

93+
Arguments to create a virtio-net device with a unix datagram or unix stream socket backend:
94+
- `type`: Unix socket type:
95+
- `unixgram`: unix datagram socket-based backend such as gvproxy or vmnet-helper.
96+
- `unixstream`: unix stream socket-based userspace network proxy such as passt or socket_vmnet.
97+
- `path`: Unix socket path. Mutually exclusive with the `fd=` option.
98+
- `fd`: Unix socket file descriptor. Mutually exclusive with the `path=` option.
99+
- `mac`: MAC address of a virtual machine.
100+
- `offloading`: (Optional) Whether or not to enable network offloading between the guest and host.
101+
Default value is `off`.
102+
- `vfkitMagic`: (Optional) Whether to send the vfkit magic value after establishing a network connection.
103+
Default value is `off`. Only supported with the `unixgram` type.
104+
105+
> [!NOTE]
106+
> The `unixSocketPath`, `type={unixgram, unixstream}` arguments are mutually exclusive and cannot be used together.
107+
91108
#### Example
92109

93-
This adds a virtio-net device to a virtual machine and redirects all guest network traffic to the corresponding
94-
socket at `/Users/user/vm-network.sock` with a MAC address of `ff:ff:ff:ff:ff:ff`:
110+
If you want to use a tool like vmnet-helper as your backend, you'll be interested in using the `type=unixgram`
111+
argument. This will create a virtio-net device and redirect all guest network traffic to the corresponding socket.
112+
Here, we're not going to use any of the optional arguments. Therefore, offloading will be disabled by default
113+
and the vfkit magic value won't be sent when the connection is established:
114+
115+
```
116+
--device virtio-net,type=unixgram,path=/Users/user/vm-network.sock,mac=ff:ff:ff:ff:ff:ff
117+
```
118+
119+
If you want to use gvproxy instead, you're going to want to use some of the optional arguments krunkit provides.
120+
We're going to want to enable offloading, and if gvproxy is running in vfkit mode, we'll also want to send the
121+
vfkit magic value when the connection establishes:
95122

96123
```
97-
--device virtio-net,unixSocketPath=/Users/user/vm-network.sock,mac=ff:ff:ff:ff:ff:ff
124+
--device virtio-net,type=unixgram,path=/Users/user/vm-network.sock,mac=ff:ff:ff:ff:ff:ff,offloading=on,vfkitMagic=on
98125
```
99126

127+
You can also use a network proxy such as passt by using the `type=unixstream` argument:
128+
```
129+
--device virtio-net,type=unixstream,fd=<passt_fd>,mac=ff:ff:ff:ff:ff:ff,offloading=true
130+
```
131+
132+
To see performance implications of choosing offloading vs. not offloading, see [this table](#offloading-performance-implications)
133+
100134
### Serial Port
101135

102136
The `virtio-serial` option adds a serial device to a virtual machine. This allows for redirection of virtual
@@ -174,3 +208,25 @@ Response: `VirtualMachineState{Running, Stopped}`
174208
`POST /vm/state` `{ "state": "Stop" }`
175209

176210
Response: `VirtualMachineStateStopped`
211+
212+
## Offloading Performance Implications
213+
214+
The table below provides some data on how offloading effects the gvproxy and vmnet-helper backends:
215+
216+
#### vment-helper offloading
217+
218+
| network | vm | offloading | iper3 | iperf3 -R |
219+
|---------------|--------- |------------|---------------|---------------|
220+
| vmnet-helper | krunkit | true | 1.38 Gbits/s | 46.20 Gbits/s |
221+
| vmnet-helper | krunkit | false | 10.10 Gbits/s | 8.38 Gbits/s |
222+
| vmnet-helper | vfkit | true | 4.27 Gbits/s | 8.09 Gbits/s |
223+
| vmnet-helper | vfkit | false | 10.70 Gbits/s | 8.41 Gbits/s |
224+
225+
#### gvproxy offloading
226+
227+
| network | vm | offloading | iper3 | iperf3 -R |
228+
|---------------|--------- |------------|---------------|---------------|
229+
| gvproxy | krunkit | true | 1.40 Gbits/s | 20.00 Gbits/s |
230+
| gvproxy | krunkit | false | 1.47 Gbits/s | 2.58 Gbits/s |
231+
| gvproxy | vfkit | false | 1.43 Gbits/s | 2.84 Gbits/s |
232+

0 commit comments

Comments
 (0)