Skip to content

Commit

Permalink
[Mellanox] Fix retry logic on discovery of MST device
Browse files Browse the repository at this point in the history
  • Loading branch information
dgsudharsan committed Sep 27, 2024
1 parent c19c7f3 commit a29d6c8
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions platform/mellanox/mlnx-fw-upgrade.j2
Original file line number Diff line number Diff line change
Expand Up @@ -182,16 +182,20 @@ function UnlockStateChange() {
function WaitForDevice() {
local -i QUERY_RETRY_COUNT_MAX="10"
local -i QUERY_RETRY_COUNT="0"
local SPC_MST_DEV
local QUERY_RC=""

local SPC_MST_DEV=$(GetSPCMstDevice)

while [[ ("${QUERY_RETRY_COUNT}" -lt "${QUERY_RETRY_COUNT_MAX}") && ("${SPC_MST_DEV}" == "${UNKN_MST}") ]]; do
while : ; do
SPC_MST_DEV=$(GetSPCMstDevice)
${QUERY_XML} -d ${SPC_MST_DEV} -o ${QUERY_FILE}
QUERY_RC="$?"
[[ ("${QUERY_RETRY_COUNT}" -lt "${QUERY_RETRY_COUNT_MAX}") && ("${QUERY_RC}" != "${EXIT_SUCCESS}") ]] || break
sleep 1s
((QUERY_RETRY_COUNT++))
SPC_MST_DEV=$(GetSPCMstDevice)
LogInfo "Retrying MST device query ${QUERY_RETRY_COUNT}"
done

if [[ "${SPC_MST_DEV}" == "${UNKN_MST}" ]]; then
if [[ "${QUERY_RC}" != "${EXIT_SUCCESS}" ]]; then
# Couldn't Detect the Spectrum ASIC. Exit failure and print the detailed information
output=$(${QUERY_CMD})
failure_msg="${output#*Fail : }"
Expand Down Expand Up @@ -232,7 +236,7 @@ function GetSPCMstDevice() {

if [[ ! -c "${_MST_DEVICE}" ]]; then
echo "${UNKN_MST}"
else
else
echo "${_MST_DEVICE}"
fi

Expand Down

0 comments on commit a29d6c8

Please sign in to comment.