From b634d8fe125914c0d02de5655b6cdca767c0762c Mon Sep 17 00:00:00 2001 From: Nir Soffer Date: Thu, 22 May 2025 02:00:33 +0300 Subject: [PATCH] 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. --- pkg/drivers/vmnet/vmnet.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/pkg/drivers/vmnet/vmnet.go b/pkg/drivers/vmnet/vmnet.go index 0bfe654304..eb0f8c44bc 100644 --- a/pkg/drivers/vmnet/vmnet.go +++ b/pkg/drivers/vmnet/vmnet.go @@ -55,6 +55,11 @@ type Helper struct { // will obtain the same MAC address from vmnet. InterfaceID string + // Offloading is required for krunkit, doss not work with vfkit. + // We must use this until libkrun add support for disabling offloading: + // https://github.com/containers/libkrun/issues/264 + Offloading bool + // Set when vmnet interface is started. macAddress string } @@ -115,13 +120,18 @@ func ValidateHelper() error { // machine. The helper will create a unix datagram socket at the specfied path. // The client (e.g. vfkit) will connect to this socket. func (h *Helper) Start(socketPath string) error { - cmd := exec.Command( - "sudo", + args := []string{ "--non-interactive", executablePath, "--socket", socketPath, "--interface-id", h.InterfaceID, - ) + } + + if h.Offloading { + args = append(args, "--enable-tso", "--enable-checksum-offload") + } + + cmd := exec.Command("sudo", args...) // Create vmnet-helper in a new process group so it is not harmed when // terminating the minikube process group.