Skip to content

Commit 0851d4c

Browse files
committed
detect VF accelerated gateway interface without explicit configuration
Today, we require that VF accelerated gateway interface must be explicitly configured. This change allows VF based accelerated gateway interface without explict configuration. Signed-off-by: Yun Zhou <[email protected]>
1 parent 0cf0999 commit 0851d4c

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

go-controller/pkg/node/gateway.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -627,19 +627,24 @@ func bridgeForInterface(intfName, nodeName,
627627
if err != nil {
628628
return nil, fmt.Errorf("gateway accelerated interface %s is not valid: %w", config.Gateway.GatewayAcceleratedInterface, err)
629629
}
630+
gwIntf = config.Gateway.GatewayAcceleratedInterface
630631
isGWAcclInterface = true
631632
klog.Infof("For gateway accelerated interface %s representor: %s", config.Gateway.GatewayAcceleratedInterface, intfRep)
633+
} else {
634+
intfRep, err = getRepresentor(gwIntf)
635+
if err == nil {
636+
isGWAcclInterface = true
637+
}
632638
}
633639

634640
if isGWAcclInterface {
635-
gatewayAcceleratedInterface := config.Gateway.GatewayAcceleratedInterface
636641
bridgeName, _, err := util.RunOVSVsctl("port-to-br", intfRep)
637642
if err != nil {
638643
return nil, fmt.Errorf("failed to find bridge that has port %s: %w", intfRep, err)
639644
}
640-
link, err := util.GetNetLinkOps().LinkByName(gatewayAcceleratedInterface)
645+
link, err := util.GetNetLinkOps().LinkByName(gwIntf)
641646
if err != nil {
642-
return nil, fmt.Errorf("failed to get netdevice link for %s: %w", gatewayAcceleratedInterface, err)
647+
return nil, fmt.Errorf("failed to get netdevice link for %s: %w", gwIntf, err)
643648
}
644649
uplinkName, err := util.GetNicName(bridgeName)
645650
if err != nil {
@@ -648,7 +653,7 @@ func bridgeForInterface(intfName, nodeName,
648653
res.bridgeName = bridgeName
649654
res.uplinkName = uplinkName
650655
res.gwIfaceRep = intfRep
651-
res.gwIface = gatewayAcceleratedInterface
656+
res.gwIface = gwIntf
652657
res.macAddress = link.Attrs().HardwareAddr
653658
} else if bridgeName, _, err := util.RunOVSVsctl("port-to-br", intfName); err == nil {
654659
// This is an OVS bridge's internal port

0 commit comments

Comments
 (0)