From a3e3d4dfde0a673cb0dab31a1c42bec9a8e8a786 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 | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/pkg/agent/dozer/bcm/plan.go b/pkg/agent/dozer/bcm/plan.go index 104cf322..7059450a 100644 --- a/pkg/agent/dozer/bcm/plan.go +++ b/pkg/agent/dozer/bcm/plan.go @@ -229,8 +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), + Description: pointer.To("Management link"), + Enabled: pointer.To(true), + AutoNegotiate: pointer.To(true), // Speed: getPortSpeed(agent, controlIface), // TODO do we need to set it for management port? Subinterfaces: map[uint32]*dozer.SpecSubinterface{ 0: { @@ -2430,21 +2431,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 }