|
6 | 6 | "strconv" |
7 | 7 | "strings" |
8 | 8 |
|
| 9 | + "github.com/pkg/errors" |
9 | 10 | kerrors "k8s.io/apimachinery/pkg/util/errors" |
10 | 11 | "sigs.k8s.io/controller-runtime/pkg/log" |
11 | 12 |
|
@@ -98,27 +99,27 @@ func (m *mellanoxHelper) GetMellanoxBlueFieldMode(PciAddress string) (BlueFieldM |
98 | 99 |
|
99 | 100 | internalCPUPageSupplierstatus, exist := mstCurrentData[internalCPUPageSupplier] |
100 | 101 | if !exist { |
101 | | - return 0, fmt.Errorf("failed to find %s in the mstconfig output command", internalCPUPageSupplier) |
| 102 | + return -1, fmt.Errorf("failed to find %s in the mstconfig output command", internalCPUPageSupplier) |
102 | 103 | } |
103 | 104 |
|
104 | 105 | internalCPUEswitchManagerStatus, exist := mstCurrentData[internalCPUEswitchManager] |
105 | 106 | if !exist { |
106 | | - return 0, fmt.Errorf("failed to find %s in the mstconfig output command", internalCPUEswitchManager) |
| 107 | + return -1, fmt.Errorf("failed to find %s in the mstconfig output command", internalCPUEswitchManager) |
107 | 108 | } |
108 | 109 |
|
109 | 110 | internalCPUIbVportoStatus, exist := mstCurrentData[internalCPUIbVporto] |
110 | 111 | if !exist { |
111 | | - return 0, fmt.Errorf("failed to find %s in the mstconfig output command", internalCPUIbVporto) |
| 112 | + return -1, fmt.Errorf("failed to find %s in the mstconfig output command", internalCPUIbVporto) |
112 | 113 | } |
113 | 114 |
|
114 | 115 | internalCPUOffloadEngineStatus, exist := mstCurrentData[internalCPUOffloadEngine] |
115 | 116 | if !exist { |
116 | | - return 0, fmt.Errorf("failed to find %s in the mstconfig output command", internalCPUOffloadEngine) |
| 117 | + return -1, fmt.Errorf("failed to find %s in the mstconfig output command", internalCPUOffloadEngine) |
117 | 118 | } |
118 | 119 |
|
119 | 120 | internalCPUModelStatus, exist := mstCurrentData[internalCPUModel] |
120 | 121 | if !exist { |
121 | | - return 0, fmt.Errorf("failed to find %s in the mstconfig output command", internalCPUModel) |
| 122 | + return -1, fmt.Errorf("failed to find %s in the mstconfig output command", internalCPUModel) |
122 | 123 | } |
123 | 124 |
|
124 | 125 | // check for DPU |
@@ -162,6 +163,15 @@ func (m *mellanoxHelper) MlxResetFW(pciAddresses []string) error { |
162 | 163 | func (m *mellanoxHelper) MlxConfigFW(attributesToChange map[string]MlxNic) error { |
163 | 164 | log.Log.Info("mellanox-plugin configFW()") |
164 | 165 | for pciAddr, fwArgs := range attributesToChange { |
| 166 | + bfMode, err := m.GetMellanoxBlueFieldMode(pciAddr) |
| 167 | + if err != nil { |
| 168 | + // NIC is not a DPU or mstconfig failed. It's safe to continue FW configuration |
| 169 | + log.Log.V(2).Info("mellanox-plugin: configFW(): can't get DPU mode for NIC", "pciAddress", pciAddr) |
| 170 | + } |
| 171 | + if bfMode == BluefieldDpu { |
| 172 | + // Host reboot won't re-load NIC firmware in DPU mode. To apply FW changes power cycle is required or mstfwreset could be used. |
| 173 | + return errors.Errorf("NIC %s is in DPU mode. Firmware configuration changes are not supported in this mode.", pciAddr) |
| 174 | + } |
165 | 175 | cmdArgs := []string{"-d", pciAddr, "-y", "set"} |
166 | 176 | if fwArgs.EnableSriov { |
167 | 177 | cmdArgs = append(cmdArgs, fmt.Sprintf("%s=True", EnableSriov)) |
|
0 commit comments