Skip to content

Commit

Permalink
block mtu change on pf when externally managed
Browse files Browse the repository at this point in the history
Signed-off-by: adrianc <adrianc@nvidia.com>
  • Loading branch information
adrianchiris committed Jan 10, 2024
1 parent dc5c9d2 commit 2af158f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/host/sriov.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,12 @@ func (s *sriov) ConfigSriovDevice(iface *sriovnetworkv1.Interface, ifaceStatus *
}
// set PF mtu
if iface.Mtu > 0 && iface.Mtu > ifaceStatus.Mtu {
if iface.ExternallyManaged {
err := fmt.Errorf("ConfigSriovDevice(): requested MTU(%d) is greater than configured MTU(%d) for device %s. cannot change MTU as policy is configured as ExternallyManaged",
iface.Mtu, ifaceStatus.Mtu, iface.PciAddress)
log.Log.Error(nil, err.Error())
return err
}
err = s.networkHelper.SetNetdevMTU(iface.PciAddress, iface.Mtu)
if err != nil {
log.Log.Error(err, "configSriovDevice(): fail to set mtu for PF", "device", iface.PciAddress)
Expand Down

0 comments on commit 2af158f

Please sign in to comment.