Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Mellanox] Fix retry logic on discovery of MST device #100

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions files/scripts/syncd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,7 @@ function startplatform() {
debug "Starting Firmware update procedure"
/usr/bin/mst start --with_i2cdev

local -r _MST_DEVICE="$(GetMstDevice)"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove GetMstDevice method from the syncd.sh i suppose

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

if [[ "${_MST_DEVICE}" != "${UNKN_MST}" ]]; then
/usr/bin/flint -d $_MST_DEVICE --clear_semaphore
fi

/usr/bin/mlnx-fw-upgrade.sh -v
/usr/bin/mlnx-fw-upgrade.sh -c -v
if [[ "$?" -ne "${EXIT_SUCCESS}" ]]; then
debug "Failed to upgrade fw. " "$?" "Restart syncd"
exit 1
Expand Down
15 changes: 15 additions & 0 deletions platform/mellanox/mlnx-fw-upgrade.j2
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ function PrintHelp() {
echo " -s, --syslog Use syslog logger (enabled when -u|--upgrade)"
echo " -v, --verbose Verbose mode (enabled when -u|--upgrade)"
echo " -d, --dry-run Compare the FW versions without installation. Return code "0" means the FW is up-to-date, return code "10" means an upgrade is required, otherwise an error is detected."
echo " -c, --clear-semaphore Clear hw resources before updating firmware"
echo " -h, --help Print help"
echo
echo "Examples:"
Expand All @@ -103,6 +104,9 @@ function ParseArguments() {
-d|--dry-run)
DRY_RUN="${YES_PARAM}"
;;
-c|--clear-semaphore)
CLEAR_SEMAPHORE="${YES_PARAM}"
;;
-h|--help)
PrintHelp
exit "${EXIT_SUCCESS}"
Expand Down Expand Up @@ -486,6 +490,15 @@ function Cleanup() {
fi
}

function ClearSemaphore() {
if [[ "${CLEAR_SEMAPHORE}" == "${YES_PARAM}" ]]; then
local -r _MST_DEVICE="$(GetSPCMstDevice)"
if [[ "${_MST_DEVICE}" != "${UNKN_MST}" ]]; then
/usr/bin/flint -d $_MST_DEVICE --clear_semaphore
fi
fi
}

trap Cleanup EXIT

ParseArguments "$@"
Expand All @@ -496,6 +509,8 @@ LockStateChange

WaitForDevice

ClearSemaphore

if [ "${IMAGE_UPGRADE}" != "${YES_PARAM}" ]; then
UpgradeFW
else
Expand Down