Skip to content

Commit 7990611

Browse files
authored
Merge pull request #816 from e0ne/dpu-mode
Do not configure BlueField NICs in DPU mode
2 parents f891498 + 1a8d74c commit 7990611

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

pkg/vendors/mellanox/mellanox.go

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"strconv"
77
"strings"
88

9+
"github.com/pkg/errors"
910
kerrors "k8s.io/apimachinery/pkg/util/errors"
1011
"sigs.k8s.io/controller-runtime/pkg/log"
1112

@@ -98,27 +99,27 @@ func (m *mellanoxHelper) GetMellanoxBlueFieldMode(PciAddress string) (BlueFieldM
9899

99100
internalCPUPageSupplierstatus, exist := mstCurrentData[internalCPUPageSupplier]
100101
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)
102103
}
103104

104105
internalCPUEswitchManagerStatus, exist := mstCurrentData[internalCPUEswitchManager]
105106
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)
107108
}
108109

109110
internalCPUIbVportoStatus, exist := mstCurrentData[internalCPUIbVporto]
110111
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)
112113
}
113114

114115
internalCPUOffloadEngineStatus, exist := mstCurrentData[internalCPUOffloadEngine]
115116
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)
117118
}
118119

119120
internalCPUModelStatus, exist := mstCurrentData[internalCPUModel]
120121
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)
122123
}
123124

124125
// check for DPU
@@ -162,6 +163,15 @@ func (m *mellanoxHelper) MlxResetFW(pciAddresses []string) error {
162163
func (m *mellanoxHelper) MlxConfigFW(attributesToChange map[string]MlxNic) error {
163164
log.Log.Info("mellanox-plugin configFW()")
164165
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+
}
165175
cmdArgs := []string{"-d", pciAddr, "-y", "set"}
166176
if fwArgs.EnableSriov {
167177
cmdArgs = append(cmdArgs, fmt.Sprintf("%s=True", EnableSriov))

0 commit comments

Comments
 (0)