-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Automatic fw upgrade for mlnx platform (#18) #31
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/bin/bash | ||
|
||
query_retry_count_max="10" | ||
required_fw_version="13.1130.0010" | ||
fw_file=/etc/mlnx/fw-SPC.mfa | ||
|
||
run_or_fail() { | ||
$1 | ||
if [[ $? != 0 ]]; then | ||
echo $1 failed | ||
exit 1 | ||
fi | ||
} | ||
|
||
# wait until devices will be available | ||
query_retry_count="0" | ||
mlxfwmanager --query > /dev/null | ||
|
||
while [[ (${query_retry_count} -lt ${query_retry_count_max}) && ($? -ne "0") ]]; do | ||
sleep 1 | ||
query_retry_count=$[${query_retry_count}+1] | ||
mlxfwmanager --query > /dev/null | ||
done | ||
|
||
run_or_fail "mlxfwmanager --query" > /tmp/mlnxfwmanager-query.txt | ||
|
||
# get current firmware version | ||
found_fw=false | ||
for word in `cat /tmp/mlnxfwmanager-query.txt` | ||
do | ||
if [[ ${found_fw} == true ]]; then | ||
fw_version=${word} | ||
break | ||
fi | ||
if [[ ${word} == FW ]]; then | ||
found_fw=true | ||
fi | ||
done | ||
|
||
if [[ -z ${fw_version} ]]; then | ||
echo "Could not retreive current FW version." | ||
exit 1 | ||
fi | ||
|
||
if [[ ${required_fw_version} == ${fw_version} ]]; then | ||
echo "Mellanox firmware is up to date." | ||
else | ||
echo "Mellanox firmware required version is ${required_fw_version}. Installing compatible version..." | ||
run_or_fail "mlxfwmanager -i ${fw_file} -u -f -y" | ||
|
||
# exit from here so that syncd service will restart | ||
exit 0 | ||
fi |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,10 @@ function clean_up { | |
|
||
trap clean_up SIGTERM SIGKILL | ||
|
||
# fw-upgrade will exit if firmware was actually upgraded or if some error | ||
# occures | ||
. mlnx-fw-upgrade.sh | ||
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. after upgrading the fw, do we need to restart the sxd kernel driver? 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. Yes, we need to restart sxd kernel in order to run newly burned firmware 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. Then it is needed to add restart sxdkernel driver logic? 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. Yes, correct 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. It is actually a trick to exit directly from mlnx-fw-upgrade.sh. Please add your comment as code comment. BTW, syncd service to restart == restart sxdkernel driver? 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. @qiluo-msft yes. restart syncd service will restart sxdkernel driver 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.
There is a comment in start.sh line 11 and mlnx-fw-upgrade.sh line 51 regarding restart logic. Anything else needed? 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. No, thanks! |
||
|
||
service rsyslog start | ||
service syncd start | ||
|
||
|
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.
which component requires this usbutils?
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.
mst utility uses usbutils and pciutils to talk to detect ASIC device