Skip to content
Closed
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
11 changes: 11 additions & 0 deletions syncd/scripts/syncd_init_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,17 @@ config_syncd_mlnx()

echo >> /tmp/sai-temp.profile

DEVICE_TYPE="$(mlxfwmanager | awk -F'Device Type: *' '/Device Type/ {print $2}')"
Copy link
Copy Markdown

@oleksandrivantsiv oleksandrivantsiv Jul 3, 2025

Choose a reason for hiding this comment

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

mlxfwmanager is too heavy to use for getting the SPC version. Please use the same approach as we have in the mlnx-fw-update.sh script with the PCI device ID:

function GetAsicType() {
    local -r VENDOR_ID="15b3"

    local -r SPC1_PRODUCT_ID="cb84"
    local -r SPC2_PRODUCT_ID="cf6c"
    local -r SPC3_PRODUCT_ID="cf70"
    local -r SPC4_PRODUCT_ID="cf80"
    local -r SPC5_PRODUCT_ID="cf82"
    local -r BF3_PRODUCT_ID="a2dc"

    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 echo $pcitree | grep "${VENDOR_ID}:${SPC2_PRODUCT_ID}" &>/dev/null; then
        echo "${SPC2_ASIC}"
        exit "${EXIT_SUCCESS}"
    elif echo $pcitree | grep "${VENDOR_ID}:${SPC3_PRODUCT_ID}" &>/dev/null; then
        echo "${SPC3_ASIC}"
        exit "${EXIT_SUCCESS}"
    elif echo $pcitree | grep "${VENDOR_ID}:${SPC4_PRODUCT_ID}" &>/dev/null; then
        echo "${SPC4_ASIC}"
        exit "${EXIT_SUCCESS}"
    elif echo $pcitree | grep "${VENDOR_ID}:${SPC5_PRODUCT_ID}" &>/dev/null; then
        echo "${SPC5_ASIC}"
        exit "${EXIT_SUCCESS}"
    elif echo $pcitree | grep "${VENDOR_ID}:${BF3_PRODUCT_ID}" &>/dev/null; then
        echo "${BF3_NIC}"
        exit "${EXIT_SUCCESS}"
    fi

    echo "${UNKN_ASIC}"
    exit "${EXIT_FAILURE}"
}

Copy link
Copy Markdown
Owner Author

@noaOrMlnx noaOrMlnx Jul 6, 2025

Choose a reason for hiding this comment

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

@oleksandrivantsiv Done. please check.
Also, please review the related PR noaOrMlnx/sonic-buildimage#66

if [ -n "$DEVICE_TYPE" ]; then
ASIC_PROFILE_FILE="sai-${DEVICE_TYPE}.profile"

ASIC_PROFILE_PATH="/etc/mlnx/${ASIC_PROFILE_FILE}"
if [ -f "$ASIC_PROFILE_PATH" ]; then
cat "$ASIC_PROFILE_PATH" >> /tmp/sai-temp.profile
echo >> /tmp/sai-temp.profile
Comment thread
noaOrMlnx marked this conversation as resolved.
fi
fi

if [[ -f $SAI_COMMON_FILE_PATH ]]; then
cat $SAI_COMMON_FILE_PATH >> /tmp/sai-temp.profile
fi
Expand Down
Loading