Skip to content

[Mellanox] Update syncd_init_common.sh to include SAI parameters from per-asic sai profile#5

Closed
noaOrMlnx wants to merge 2 commits intomasterfrom
mlnx-asic-common-sai-profile
Closed

[Mellanox] Update syncd_init_common.sh to include SAI parameters from per-asic sai profile#5
noaOrMlnx wants to merge 2 commits intomasterfrom
mlnx-asic-common-sai-profile

Conversation

@noaOrMlnx
Copy link
Copy Markdown
Owner

@noaOrMlnx noaOrMlnx commented Jul 2, 2025

Changed config_mlnx_syncd() functionality to use per-asic sai.profile for all Spectrum{x} SKUs.
The function will apply specific SKU sai.profile, then per-asic sai.profile and lastly - sai-common.profile (which is for all Mellanox SKUs).

Why I did it
To have the ability to add common parameters to only 1 file instead of all SKUs - but per asic.

depends on noaOrMlnx/sonic-buildimage#66 that installs pciutils to Mellanox syncd docker - so we could execute lspci command inside syncd docker.

@noaOrMlnx noaOrMlnx force-pushed the mlnx-asic-common-sai-profile branch from c476fce to f84f328 Compare July 2, 2025 12:49
Copy link
Copy Markdown

@DavidZagury DavidZagury left a comment

Choose a reason for hiding this comment

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

Great, approved


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

@noaOrMlnx noaOrMlnx closed this Aug 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants