From 60a777c9174604eec17f1598552b16b55ff5964e Mon Sep 17 00:00:00 2001 From: Ivan Kolodiazhnyi Date: Fri, 13 Dec 2024 16:51:59 +0200 Subject: [PATCH 1/2] Do not configure BlueField NICs in DPU mode Signed-off-by: Ivan Kolodiazhnyi --- pkg/vendors/mellanox/mellanox.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/vendors/mellanox/mellanox.go b/pkg/vendors/mellanox/mellanox.go index 82410c7f8..a29429db4 100644 --- a/pkg/vendors/mellanox/mellanox.go +++ b/pkg/vendors/mellanox/mellanox.go @@ -6,6 +6,7 @@ import ( "strconv" "strings" + "github.com/pkg/errors" kerrors "k8s.io/apimachinery/pkg/util/errors" "sigs.k8s.io/controller-runtime/pkg/log" @@ -162,6 +163,15 @@ func (m *mellanoxHelper) MlxResetFW(pciAddresses []string) error { func (m *mellanoxHelper) MlxConfigFW(attributesToChange map[string]MlxNic) error { log.Log.Info("mellanox-plugin configFW()") for pciAddr, fwArgs := range attributesToChange { + bfMode, err := m.GetMellanoxBlueFieldMode(pciAddr) + if err != nil { + // NIC is not a DPU or mstconfig failed. It's safe to continue FW configuration + log.Log.V(2).Info("mellanox-plugin: configFW(): can't get DPU mode for NIC", "pciAddress", pciAddr) + } + if bfMode == BluefieldDpu { + // Host reboot won't re-load NIC firmware in DPU mode. To apply FW changes power cycle is required or mstfwreset could be used. + return errors.Errorf("NIC %s is in DPU mode. Firmware configuration changes are not supported in this mode.", pciAddr) + } cmdArgs := []string{"-d", pciAddr, "-y", "set"} if fwArgs.EnableSriov { cmdArgs = append(cmdArgs, fmt.Sprintf("%s=True", EnableSriov)) From 1a8d74cbeb7e3e0781d072b44ca57b50fc41ffe1 Mon Sep 17 00:00:00 2001 From: Ivan Kolodiazhnyi Date: Mon, 6 Jan 2025 10:43:24 +0200 Subject: [PATCH 2/2] Do not return DPU mode on error Signed-off-by: Ivan Kolodiazhnyi --- pkg/vendors/mellanox/mellanox.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/vendors/mellanox/mellanox.go b/pkg/vendors/mellanox/mellanox.go index a29429db4..65106ab0f 100644 --- a/pkg/vendors/mellanox/mellanox.go +++ b/pkg/vendors/mellanox/mellanox.go @@ -99,27 +99,27 @@ func (m *mellanoxHelper) GetMellanoxBlueFieldMode(PciAddress string) (BlueFieldM internalCPUPageSupplierstatus, exist := mstCurrentData[internalCPUPageSupplier] if !exist { - return 0, fmt.Errorf("failed to find %s in the mstconfig output command", internalCPUPageSupplier) + return -1, fmt.Errorf("failed to find %s in the mstconfig output command", internalCPUPageSupplier) } internalCPUEswitchManagerStatus, exist := mstCurrentData[internalCPUEswitchManager] if !exist { - return 0, fmt.Errorf("failed to find %s in the mstconfig output command", internalCPUEswitchManager) + return -1, fmt.Errorf("failed to find %s in the mstconfig output command", internalCPUEswitchManager) } internalCPUIbVportoStatus, exist := mstCurrentData[internalCPUIbVporto] if !exist { - return 0, fmt.Errorf("failed to find %s in the mstconfig output command", internalCPUIbVporto) + return -1, fmt.Errorf("failed to find %s in the mstconfig output command", internalCPUIbVporto) } internalCPUOffloadEngineStatus, exist := mstCurrentData[internalCPUOffloadEngine] if !exist { - return 0, fmt.Errorf("failed to find %s in the mstconfig output command", internalCPUOffloadEngine) + return -1, fmt.Errorf("failed to find %s in the mstconfig output command", internalCPUOffloadEngine) } internalCPUModelStatus, exist := mstCurrentData[internalCPUModel] if !exist { - return 0, fmt.Errorf("failed to find %s in the mstconfig output command", internalCPUModel) + return -1, fmt.Errorf("failed to find %s in the mstconfig output command", internalCPUModel) } // check for DPU