From 3e8d48769383e9fb8500dd05081a73c270a30d9a Mon Sep 17 00:00:00 2001 From: Sebastian Sch Date: Mon, 25 Jul 2022 17:19:50 +0300 Subject: [PATCH] load vhost-net kernel module This commit is needed when using DPDK with vhost-net in virtio mode. We must load the vhost-net kernel module if we don't want the dpdk application to run with privilege Signed-off-by: Sebastian Sch --- pkg/daemon/daemon.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/daemon/daemon.go b/pkg/daemon/daemon.go index 73f7ebb93..f56ba36af 100644 --- a/pkg/daemon/daemon.go +++ b/pkg/daemon/daemon.go @@ -206,6 +206,7 @@ func (dn *Daemon) Run(stopCh <-chan struct{}, exitCh <-chan error) error { tryEnableRdma() tryEnableTun() + tryEnableVhostNet() if err := dn.tryCreateUdevRuleWrapper(); err != nil { return err @@ -905,6 +906,12 @@ func tryEnableTun() { } } +func tryEnableVhostNet() { + if err := utils.LoadKernelModule("vhost_net"); err != nil { + glog.Errorf("tryEnableVhostNet(): VHOST_NET kernel module not loaded: %v", err) + } +} + func tryEnableRdma() (bool, error) { glog.V(2).Infof("tryEnableRdma()") var stdout, stderr bytes.Buffer