Skip to content

Commit b805093

Browse files
committed
vmnet: Support offloading for krunkit
libkrun virtio-net driver enables TSO offloading and checksum offloading by default, so we must use vment-helper --enable-tso and --enable-checksum-offload with krunkit. These options do not work with vfkit.
1 parent 3cf1e63 commit b805093

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

pkg/drivers/vmnet/vmnet.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ type Helper struct {
5555
// will obtain the same MAC address from vmnet.
5656
InterfaceID string
5757

58+
// Offloading is required for krunkit, doss not work with vfkit.
59+
// We must use this until libkrun add support for disabling offloading:
60+
// https://github.com/containers/libkrun/issues/264
61+
Offloading bool
62+
5863
// Set when vmnet interface is started.
5964
macAddress string
6065
}
@@ -115,13 +120,18 @@ func ValidateHelper() error {
115120
// machine. The helper will create a unix datagram socket at the specfied path.
116121
// The client (e.g. vfkit) will connect to this socket.
117122
func (h *Helper) Start(socketPath string) error {
118-
cmd := exec.Command(
119-
"sudo",
123+
args := []string{
120124
"--non-interactive",
121125
executablePath,
122126
"--socket", socketPath,
123127
"--interface-id", h.InterfaceID,
124-
)
128+
}
129+
130+
if h.Offloading {
131+
args = append(args, "--enable-tso", "--enable-checksum-offload")
132+
}
133+
134+
cmd := exec.Command("sudo", args...)
125135

126136
// Create vmnet-helper in a new process group so it is not harmed when
127137
// terminating the minikube process group.

0 commit comments

Comments
 (0)