Skip to content

Commit

Permalink
Fix sriov.configureHWOptionsForSwitchdev function
Browse files Browse the repository at this point in the history
Fix the function to correctly handle
devices which doesn't support
software_steering

Signed-off-by: Yury Kulazhenkov <[email protected]>
  • Loading branch information
ykulazhenkov committed Mar 20, 2024
1 parent f296db7 commit 68ef448
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/host/internal/sriov/sriov.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,8 @@ func (s *sriov) configureHWOptionsForSwitchdev(iface *sriovnetworkv1.Interface)
desiredFlowSteeringMode := "smfs"
currentFlowSteeringMode, err := s.networkHelper.GetDevlinkDeviceParam(iface.PciAddress, "flow_steering_mode")
if err != nil {
if errors.Is(err, syscall.EINVAL) {
log.Log.V(2).Info("configureHWOptionsForSwitchdev(): software flow steering is not supported by the device, skip configuration",
if errors.Is(err, syscall.EINVAL) || errors.Is(err, syscall.ENODEV) {
log.Log.V(2).Info("configureHWOptionsForSwitchdev(): device has no flow_steering_mode parameter, skip",
"device", iface.PciAddress)
return nil
}
Expand All @@ -369,6 +369,10 @@ func (s *sriov) configureHWOptionsForSwitchdev(iface *sriovnetworkv1.Interface)
s.setEswitchModeAndNumVFs(iface.PciAddress, sriovnetworkv1.ESwithModeLegacy, 0)
}
if err := s.networkHelper.SetDevlinkDeviceParam(iface.PciAddress, "flow_steering_mode", desiredFlowSteeringMode); err != nil {
if errors.Is(err, syscall.ENOTSUP) {
log.Log.V(2).Info("configureHWOptionsForSwitchdev(): device doesn't support changing of flow_steering_mode, skip", "device", iface.PciAddress)
return nil
}
log.Log.Error(err, "configureHWOptionsForSwitchdev(): fail to configure flow steering mode for the device", "device", iface.PciAddress)
return err
}
Expand Down

0 comments on commit 68ef448

Please sign in to comment.