From 10401ed1c53c4eb5e50db7a04c2c5875d5e8490e Mon Sep 17 00:00:00 2001 From: Sergei Lukianov Date: Mon, 27 Jan 2025 21:15:57 -0800 Subject: [PATCH] Fix port auto neg handling to avoid unappliable diff Fixes #658 Signed-off-by: Sergei Lukianov --- pkg/agent/dozer/bcm/plan.go | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/pkg/agent/dozer/bcm/plan.go b/pkg/agent/dozer/bcm/plan.go index 104cf322..b3925d37 100644 --- a/pkg/agent/dozer/bcm/plan.go +++ b/pkg/agent/dozer/bcm/plan.go @@ -229,9 +229,9 @@ func planControlLink(agent *agentapi.Agent, spec *dozer.Spec) error { prefixLen, _ := ipNet.Mask.Size() spec.Interfaces[controlIface] = &dozer.SpecInterface{ - Description: pointer.To("Management link"), - Enabled: pointer.To(true), - // Speed: getPortSpeed(agent, controlIface), // TODO do we need to set it for management port? + Description: pointer.To("Management link"), + Enabled: pointer.To(true), + AutoNegotiate: pointer.To(true), Subinterfaces: map[uint32]*dozer.SpecSubinterface{ 0: { IPs: map[string]*dozer.SpecInterfaceIP{ @@ -2430,21 +2430,15 @@ func planPortAutoNegs(agent *agentapi.Agent, spec *dozer.Spec) error { } for name, iface := range spec.Interfaces { - if !isHedgehogPortName(name) || !autoNegAllowed[name] { + if !isHedgehogPortName(name) || strings.HasPrefix(name, wiringapi.ManagementPortPrefix) { continue } - val := pointer.To(autoNegDefault[name]) - - if strings.HasPrefix(name, "M") { - val = pointer.To(true) - } - - iface.AutoNegotiate = val + iface.AutoNegotiate = pointer.To(autoNegDefault[name]) } for name, autoNeg := range agent.Spec.Switch.PortAutoNegs { - if !isHedgehogPortName(name) || strings.HasPrefix(name, "M") || !autoNegAllowed[name] { + if !isHedgehogPortName(name) || strings.HasPrefix(name, wiringapi.ManagementPortPrefix) || !autoNegAllowed[name] { continue }