diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index 37888e4b1..0daf90a78 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -2,6 +2,7 @@ package utils import ( "bytes" + "errors" "fmt" "io/ioutil" "math/rand" @@ -666,7 +667,7 @@ func unbindDriverIfNeeded(vfAddr string, isRdma bool) error { } func getLinkType(ifaceStatus sriovnetworkv1.InterfaceExt) string { - glog.Infof("getLinkType(): Device %s", ifaceStatus.PciAddress) + glog.V(2).Infof("getLinkType(): Device %s", ifaceStatus.PciAddress) if ifaceStatus.Name != "" { link, err := netlink.LinkByName(ifaceStatus.Name) if err != nil { @@ -720,10 +721,16 @@ func generateRandomGUID() net.HardwareAddr { func GetNicSriovMode(pciAddress string) (string, error) { glog.V(2).Infof("GetNicSriovMode(): device %s", pciAddress) + devLink, err := netlink.DevLinkGetDeviceByName("pci", pciAddress) if err != nil { + if errors.Is(err, syscall.ENODEV) { + // the device doesn't support devlink + return "", nil + } return "", err } + return devLink.Attrs.Eswitch.Mode, nil }