Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip vf configuration when not found in VF group #539

Merged
merged 3 commits into from
Nov 23, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pkg/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,12 +462,14 @@ func configSriovDevice(iface *sriovnetworkv1.Interface, ifaceStatus *sriovnetwor
i := 0
var dpdkDriver string
var isRdma bool
found := false
vfID, err := dputils.GetVFID(addr)
for i, group = range iface.VfGroups {
if err != nil {
log.Log.Error(err, "configSriovDevice(): unable to get VF id", "device", iface.PciAddress)
}
if sriovnetworkv1.IndexInRange(vfID, group.VfRange) {
found = true
isRdma = group.IsRdma
if sriovnetworkv1.StringInArray(group.DeviceType, DpdkDrivers) {
dpdkDriver = group.DeviceType
Expand All @@ -476,6 +478,11 @@ func configSriovDevice(iface *sriovnetworkv1.Interface, ifaceStatus *sriovnetwor
}
}

// Do not configure VF which is not part of any VF Group.
if !found {
continue
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is essentially filtering the list of addresses to process. Now, the body of the loop does much too much imo. Let's take the opportunity to refactor this whole function to have a more proper way to filter the list

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, please have a look again


// only set GUID and MAC for VF with default driver
// for userspace drivers like vfio we configure the vf mac using the kernel nic mac address
// before we switch to the userspace driver
Expand Down
Loading