diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index ca8ad4f10b..c642032b65 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -287,13 +287,7 @@ func configSriovDevice(iface *sriovnetworkv1.Interface, ifaceStatus *sriovnetwor break } } - if strings.EqualFold(iface.LinkType, "IB") { - if err = setVfGuid(addr, pfLink); err != nil { - return err - } - } else if err = setVfAdminMac(addr, pfLink); err != nil { - return err - } + if err = unbindDriverIfNeeded(addr, isRdma); err != nil { return err } @@ -309,6 +303,15 @@ func configSriovDevice(iface *sriovnetworkv1.Interface, ifaceStatus *sriovnetwor return err } } + + // only set GUID and MAC for VF with default driver + if strings.EqualFold(iface.LinkType, "IB") { + if err = setVfGuid(addr, pfLink); err != nil { + return err + } + } else if err = setVfAdminMac(addr, pfLink); err != nil { + return err + } } else { if err := BindDpdkDriver(addr, driver); err != nil { glog.Warningf("configSriovDevice(): fail to bind driver %s for device %s", driver, addr)