Skip to content

Commit

Permalink
[Mellanox] Fix the issue with ASIC detection on the SN4280 platform
Browse files Browse the repository at this point in the history
  • Loading branch information
oleksandrivantsiv committed Sep 27, 2024
1 parent bd2d4c3 commit d7343d6
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions platform/mellanox/mlnx-fw-upgrade.j2
Original file line number Diff line number Diff line change
Expand Up @@ -238,19 +238,31 @@ function GetAsicType() {
local -r SPC4_PRODUCT_ID="cf80"
local -r BF3_PRODUCT_ID="a2dc"

if lspci -n | grep "${VENDOR_ID}:${SPC1_PRODUCT_ID}" &>/dev/null; then
local -i QUERY_RETRY_COUNT="0"
local -i QUERY_RETRY_COUNT_MAX="10"
local pcitree=$(lspci -n 2>/dev/null)
ERROR_CODE="$?"

while [[ ("${QUERY_RETRY_COUNT}" -lt "QUERY_RETRY_COUNT_MAX") && ("${ERROR_CODE}" != "${EXIT_SUCCESS}") ]]; do
sleep 1s
((QUERY_RETRY_COUNT++))
pcitree=$(lspci -n 2>/dev/null)
ERROR_CODE="$?"
done

if echo $pcitree | grep "${VENDOR_ID}:${SPC1_PRODUCT_ID}" &>/dev/null; then
echo "${SPC1_ASIC}"
exit "${EXIT_SUCCESS}"
elif lspci -n | grep "${VENDOR_ID}:${SPC2_PRODUCT_ID}" &>/dev/null; then
elif echo $pcitree | grep "${VENDOR_ID}:${SPC2_PRODUCT_ID}" &>/dev/null; then
echo "${SPC2_ASIC}"
exit "${EXIT_SUCCESS}"
elif lspci -n | grep "${VENDOR_ID}:${SPC3_PRODUCT_ID}" &>/dev/null; then
elif echo $pcitree | grep "${VENDOR_ID}:${SPC3_PRODUCT_ID}" &>/dev/null; then
echo "${SPC3_ASIC}"
exit "${EXIT_SUCCESS}"
elif lspci -n | grep "${VENDOR_ID}:${SPC4_PRODUCT_ID}" &>/dev/null; then
elif echo $pcitree | grep "${VENDOR_ID}:${SPC4_PRODUCT_ID}" &>/dev/null; then
echo "${SPC4_ASIC}"
exit "${EXIT_SUCCESS}"
elif lspci -n | grep "${VENDOR_ID}:${BF3_PRODUCT_ID}" &>/dev/null; then
elif echo $pcitree | grep "${VENDOR_ID}:${BF3_PRODUCT_ID}" &>/dev/null; then
echo "${BF3_NIC}"
exit "${EXIT_SUCCESS}"
fi
Expand Down

0 comments on commit d7343d6

Please sign in to comment.