From 41b2c9db022081cdc987cffb0f4a624104a9b501 Mon Sep 17 00:00:00 2001 From: Ivan Kolodyazhny Date: Fri, 1 Apr 2022 13:21:59 +0300 Subject: [PATCH] Fix VFs configuration for InfiniBand NICs Closes: #274 --- pkg/utils/utils.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index 3edd0e6385..31dae09fc5 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -299,7 +299,13 @@ func configSriovDevice(iface *sriovnetworkv1.Interface, ifaceStatus *sriovnetwor // for userspace drivers like vfio we configure the vf mac using the kernel nic mac address // before we switch to the userspace driver if yes, d := hasDriver(addr); yes && !sriovnetworkv1.StringInArray(d, DpdkDrivers) { - if strings.EqualFold(iface.LinkType, "IB") { + // LinkType is an optional field. Let's fallback to current link type + // if nothing is specified in the SriovNodePolicy + linkType := ifaceStatus.LinkType + if linkType == "" { + linkType = ifaceStatus.LinkType + } + if strings.EqualFold(linkType, "IB") { if err = setVfGuid(addr, pfLink); err != nil { return err }