forked from sonic-net/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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:" | ||
|
@@ -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}" | ||
|
@@ -210,16 +214,20 @@ function WaitForDevice() { | |
local -i QUERY_RETRY_COUNT_MAX="10" | ||
local -i QUERY_RETRY_COUNT="0" | ||
local -r DEVICE_TYPE=$(GetMstDeviceType) | ||
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} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is only adding 0.2 - 03 sec in SPC1 device under a high load. So, doesn't look a big hit to me |
||
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 : }" | ||
|
@@ -265,7 +273,7 @@ function GetSPCMstDevice() { | |
|
||
if [[ ! -c "${_MST_DEVICE}" ]]; then | ||
echo "${UNKN_MST}" | ||
else | ||
else | ||
echo "${_MST_DEVICE}" | ||
fi | ||
|
||
|
@@ -482,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 "$@" | ||
|
@@ -492,6 +509,8 @@ LockStateChange | |
|
||
WaitForDevice | ||
|
||
ClearSemaphore | ||
|
||
if [ "${IMAGE_UPGRADE}" != "${YES_PARAM}" ]; then | ||
UpgradeFW | ||
else | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.