Skip to content

Commit

Permalink
load vhost-net kernel module
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
SchSeba committed Jul 26, 2022
1 parent 815fd13 commit 3e8d487
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3e8d487

Please sign in to comment.